问题描述
这是我的API响应:
{"movie_results":[],"person_results":[],"tv_results":[],"tv_episode_results":[{"air_date":"1996-01-09","episode_number":1,"id":953004,"name":"Brains and Eggs","overview":"Solomon discovers that human bodies can produce feelings,and he's feeling attracted to a college professor with whom he shares an office.","production_code":"101","season_number":1,"show_id":155,"still_path":null,"Vote_average":9.0,"Vote_count":2}],"tv_season_results":[]}
当我使用此代码时
$json = json_decode($response);
$array = get_object_vars($json);
if(empty($array['tv_episode_results'])){
$db->query("INSERT INTO episodes (season_id,movie_id,episode_number,episode_name,episode_description,episode_thumbnail,episode_source,is_embed,actor_id,ratings,season_sub_id)
VALUES ('".$season_id."','".$video_id."','".$episode_number."','".$epName."','discription Coming Soon.','814512c0eb40e98a0f15cf493f8c6096maxresdefault-1.jpg','".$source."','0','','".$season_subnumber."')");
}
数据库中的Episode_thumbnail应该具有814512c0eb40e98a0f15cf493f8c6096maxresdefault-1.jpg 默认情况下,如果静态路径为空(来自响应),但它似乎不起作用。其余代码工作正常。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)