我得到這個錯誤:需要幫助診斷:解析錯誤:語法錯誤,意想不到的T_FUNCTION
Parse error: syntax error, unexpected T_FUNCTION
這段代碼:
<?php
$uniqueFtypes = $ftypes = $converter->GetConvertedFileTypes();
array_walk(
$uniqueFtypes,
function(&$ftype, $key) {
$ftype = $ftype['fileExt'];
}
);
$uniqueFtypes = array_values(array_unique($uniqueFtypes));
foreach ($uniqueFtypes as $key => $uftype)
{
echo $uftype;
echo ($uftype != end($uniqueFtypes)) ? (($key != count($uniqueFtypes)-2) ? ', ' : ', or ') : '';
}
?>
在這一行:
array_walk(
$uniqueFtypes,
function(&$ftype, $key) {
$ftype = $ftype['fileExt'];
}
);
PHP版本:5.2.17
它在localhost上運行,我正在使用最新的UniServer。但是當我將它移到我的主機時,它會發生這種錯誤。
任何幫助? :)
編輯:這裏是其他人不知道它需要修復。
ini_set('max_execution_time',0);
ini_set('display_errors',0);
// Instantiate converter class
include 'VideoConverter.class.php';
$converter = new VideoConverter();
// On download of converted file
if (isset($_GET['output']))
{
$converter->DownloadConvertedFile($_GET['output']);
}
二
$vidHosts = array_values($converter->GetVideoHosts());
foreach ($vidHosts as $key => $host)
{
echo $host['name'];
echo ($host != end($vidHosts)) ? (($key == count($vidHosts)-2) ? ((count($vidHosts) > 2) ? ', and ' : ' and ') : ', ') : '';
}
有什麼需要這2也固定?
您是否確認本地主機和遠程主機上的PHP版本相同? – Sepster