【发布时间】:2015-04-27 12:16:44
【问题描述】:
我有 mp3 网站,当我点击下载时出现类似这样的错误,所以我可以解决这个问题,请帮帮我,我正在等你们,所以请给我打电话,我也删除了那个空间,但如果完整代码仍然会发出这个问题当我点击下载它的重定向到主页时,这是一个不同的问题,之前我没有解释完整现在这里也充满了完整的代码
PHP 解析错误:语法错误,第 42 行 /home/xxx/public_html/xxxx/xxxx/themes/xxxx/functions/source/download_mp3.php 中的意外 '$title' (T_VARIABLE)
<?php
require_once('../../../../../wp-load.php');
if(isset($_REQUEST['filename'])) {
$filename = $_REQUEST['filename'];
} else {
echo '<p>No id passed in</p>';
exit;
}
function checkRemoteFile($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
// don't download content
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(curl_exec($ch)!==FALSE){
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (($code == 301) || ($code == 302)) {
return false;
}else{
return true;
}
}else{
return false;
}
}
$checkMp3 = checkRemoteFile( base64_url_decode( $filename ) );
$title=$_GET['ref'];
$mp3file = base64_url_decode( $filename );
if($checkMp3){
?>
<html>
<head>
<title>Download Mp3</title>
</head>
<body>
<div class="downButtons" style="margin:5px">
<b class="red">Choose a server to download your song!</b>
<br><br><a rel="nofollow" target="_blank" title="Right Click to Download Mp3"class="dr dss" href="/download?mp3=<?php echo $mp3file;?>&title=<?php echo $title;?>"><img style="max-height:60px"src="http://ppp.com/download.jpg"></a>
</body>
</html>
<?php
}
else
{
echo '<div style="font-size:11px;text-align: center;color: black;">file not found, try other download link</div>';
}
?>
这是第 42 行错误代码
<br><br><a rel="nofollow" target="_blank" title="Right Click to Download Mp3"class="dr dss" href="/download?mp3=<?php echo $mp3file;?>&title=<?php echo $title;?>"><img style="max-height:60px"src="http://ppp.com/download.jpg"></a>
【问题讨论】:
-
为了防止错误尝试使用 $title=isset( $_GET['ref'] ) ? $_GET['ref'] : '';
-
请不要在 cmets 中转储代码。使用附加信息更新您的原始帖子。