簡體   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