繁体   English   中英

php error Parse error :语法错误,意外':'in

[英]php error <b>Parse error</b>: syntax error, unexpected ':' in

我正在使用Flash和PHP来创建JPG。 我在我的localhost服务器上按预期运行Flash和PHP。 当我上传到服务器时,我收到以下错误:


解析错误 :语法错误,第6/home/carlosrg/public_html/mysubdomain/image.php中的意外':'

和代码:

<?PHP
date_default_timezone_set('America/Los_Angeles');

$targetFilename = date(‘YmdHis’).’_’.mt_rand().’.jpg’;

$serverpath = ‘http://www.mysubdomain.myserver.com';
$directoryPath = ‘/newimagesfolder/‘;

$target_path = $_SERVER['DOCUMENT_ROOT'].$directoryPath.$targetFilename;

if ( move_uploaded_file( $_FILES[ 'userfile' ][ 'tmp_name' ], $target_path ) ) 
{
    echo $serverpath.$directoryPath.$targetFilename;
} 
else
{
     echo "error";
}
?>

提前谢谢您的时间。

你使用的是错误的引号。 '应该是正常的单引号' 有什么奇怪的是你在这段代码中的其他地方更正。 看起来像是一个可能的剪切和粘贴错误。

您已经使用'你需要使用单或双' '或"行情

 $targetFilename = date("YmdHis")."_".mt_rand().".jpg";

 $serverpath = "http://www.mysubdomain.myserver.com";
 $directoryPath = "/newimagesfolder/";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM