每次执行下面的代码时,都会收到此错误:Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 133955562 bytes) in /home/vhosts/schoolvids.nl/subdomains/admin/httpdocs/home.php on line 100
第100行:$response .= substr($string,0, stripos($string,"http://")).$url;
$query = "SELECT youtube_id FROM video WHERE beschrijving = '' LIMIT 1";
$result = mysqli_query($con,$query) or die(mysqli_error($con));
while($data = mysqli_fetch_assoc($result)) {
//$beschrijving = sqlesc(formatYtDescr($data['youtube_id']));
$json_output = file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$data['youtube_id']."?v=2&alt=json");
$json = json_decode($json_output, true);
$string = $json['entry']['media$group']['media$description']['$t'];
$string = preg_replace("/\n/", " <br>",$string);
$string = str_replace("https://", "http://", $string);
$response = "";
if(stripos($string, "http://")){
while(stripos($string, "http://")) {
$link = substr($string, stripos($string, "http://"), stripos($string, " ", stripos($string,"http://")) - stripos($string, "http://"));
$url = "<a href=\"".$link."\" target=\"_blank\">".$link."</a>";
$response .= substr($string,0, stripos($string,"http://")).$url;
$string = substr($string, stripos($string, " ", stripos($string,"http://")));
}
$response .= $string;
}else{
$response = $string;
}
$query = "UPDATE video SET beschrijving='$response' WHERE youtube_id = '".$data['youtube_id']."'";
mysqli_query($con,$query) or die(mysqli_error($con));
}
当我通过直接插入值而不是从数据库接收youtube_id
来运行代码时,我的代码完美无缺。有人可以向我解释我做错了吗?