标题: 求助腾讯云函数运行php
时间: 2021-11-06发布,2021-11-06修改
『回复列表(4|隐藏机器人聊天)』
<?php
function main_handler($event, $context) {
//代码全部放到这个函数里面去,就像下面这样,对于有自定义函数的放到这个函数外面就行了
$str = file_get_contents('http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1'); //读取必应api,获得相应数据
$str = json_decode($str,true);
print_r($str);
$imgurl = 'http://cn.bing.com'.$str['images'][0]['url'];
return $imgurl;
}
?>