运行php代码时,出现错误提示
Parseerror:syntaxerror,unexpected'{'online3,运行下面代码是一直出现这个错误提示:这是什么问题?<?phprequire_onc...
Parse error: syntax error, unexpected '{' on line 3,运行下面代码是一直出现这个错误提示:这是什么问题?
<?php
require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
class tx_tmplselect_addfilestosel {
var $dir = "main";
/**
* Manipulating the input array, $params, adding new selectorbox items.
*/
function main(&$params,&$pObj) {
// configuration of paths for template files:
$confArray = array(
"main" => "fileadmin/template/main/",
"sub" => "fileadmin/template/sub/"
);
// Finding value for the path containing the template files.
$readPath = t3lib_div::getFileAbsFileName($confArray[$this->dir]);
// If that directory is valid, is a directory then select files in it:
if (@is_dir($readPath)) {
// Getting all HTML files in the directory:
$template_files = t3lib_div::getFilesInDir($readPath,'html,htm',1,1);
// Start up the HTML parser:
$parseHTML = t3lib_div::makeInstance('t3lib_parseHTML');
// Traverse that array:
foreach($template_files as $htmlFilePath) {
// Reset vars:
$selectorBoxItem_title='';
$selectorBoxItem_icon='';
// Reading the content of the template document...
$content = t3lib_div::getUrl($htmlFilePath);
// ... and extracting the content of the title-tags:
$parts = $parseHTML->splitIntoBlock('title',$content);
$titleTagContent = $parseHTML->removeFirstAndLastTag($parts[1]);
// Setting the item label:
$selectorBoxItem_title = trim($titleTagContent.' ('.basename($htmlFilePath).')');
// Trying to look up an image icon for the template
$fI = t3lib_div::split_fileref($htmlFilePath);
$testImageFilename=$readPath.$fI['filebody'].'.gif';
if (@is_file($testImageFilename)) { // If an icon was found, set the icon reference value:
$selectorBoxItem_icon = '../'.substr($testImageFilename,strlen(PATH_site));
}
// Finally add the new item:
$params["items"][]=Array(
$selectorBoxItem_title,
basename($htmlFilePath),
$selectorBoxItem_icon
);
}
}
// No return - the $params and $pObj variables are passed by reference, so just change content in them and it is passed back automatically...
}
}
class tx_tmplselect_addfilestosel_ca extends tx_tmplselect_addfilestosel {
var $dir = "sub";
}
?> 展开
<?php
require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
class tx_tmplselect_addfilestosel {
var $dir = "main";
/**
* Manipulating the input array, $params, adding new selectorbox items.
*/
function main(&$params,&$pObj) {
// configuration of paths for template files:
$confArray = array(
"main" => "fileadmin/template/main/",
"sub" => "fileadmin/template/sub/"
);
// Finding value for the path containing the template files.
$readPath = t3lib_div::getFileAbsFileName($confArray[$this->dir]);
// If that directory is valid, is a directory then select files in it:
if (@is_dir($readPath)) {
// Getting all HTML files in the directory:
$template_files = t3lib_div::getFilesInDir($readPath,'html,htm',1,1);
// Start up the HTML parser:
$parseHTML = t3lib_div::makeInstance('t3lib_parseHTML');
// Traverse that array:
foreach($template_files as $htmlFilePath) {
// Reset vars:
$selectorBoxItem_title='';
$selectorBoxItem_icon='';
// Reading the content of the template document...
$content = t3lib_div::getUrl($htmlFilePath);
// ... and extracting the content of the title-tags:
$parts = $parseHTML->splitIntoBlock('title',$content);
$titleTagContent = $parseHTML->removeFirstAndLastTag($parts[1]);
// Setting the item label:
$selectorBoxItem_title = trim($titleTagContent.' ('.basename($htmlFilePath).')');
// Trying to look up an image icon for the template
$fI = t3lib_div::split_fileref($htmlFilePath);
$testImageFilename=$readPath.$fI['filebody'].'.gif';
if (@is_file($testImageFilename)) { // If an icon was found, set the icon reference value:
$selectorBoxItem_icon = '../'.substr($testImageFilename,strlen(PATH_site));
}
// Finally add the new item:
$params["items"][]=Array(
$selectorBoxItem_title,
basename($htmlFilePath),
$selectorBoxItem_icon
);
}
}
// No return - the $params and $pObj variables are passed by reference, so just change content in them and it is passed back automatically...
}
}
class tx_tmplselect_addfilestosel_ca extends tx_tmplselect_addfilestosel {
var $dir = "sub";
}
?> 展开
展开全部
要完整的出错信息,同时,要有行号的代码,才好判断具体问题。
你这提示,就是缺少大括号了。
你这提示,就是缺少大括号了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
如果这个文件有问题的话也会报错
关键是看报错信息出现的是在哪个文件里 你这报错信息不完整
如果这个文件有问题的话也会报错
关键是看报错信息出现的是在哪个文件里 你这报错信息不完整
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
语法错误看看标签闭合错误
追问
我检查了一下,括号都是匹配的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询