I can't figure out where this error is located. Line 1 is <?php
also i'm using a phpIDE app and its not showing any errors / missing braces.
我不知道这个错误在哪里。1号线是< ?php我也在使用phpIDE应用程序,它没有显示任何错误/缺失的大括号。
PHP Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in /home/ratemy/public_html/kernel/parser.php(190) : eval()'d code on line 1
PHP解析错误:语法错误,意外的'(',期望T_STRING或T_VARIABLE或'{'或'$' in /home/ratemy/public_html/kernel/parser.php(190): eval()'d ' code on line 1
code lines from 167 - 200... line 190 is marked below.
代码行从167 - 200…第190行标记如下。
# Format replaced vars
function do_format($value,$s) {
global $en;
$value = (isset($en[$value]) ? $en[$value] : @constant($value));
$i = strtolower($s);
if (strpos($i,'echo') || strpos($i,'define')) {
$value = str_replace('"','`',$value);
$value = str_replace(chr(39),'`',$value);
}
return $value;
}
# Execute template block
function exec_block($start, $end, $jump = -2) {
$this->tpi = $start - 1;
while ($this->tpi < $end) {
$s = $this->templ_read();
$this->s = $this->template_replace_vars($s);
if ($this->act[$this->tpi] == 'continue_loop') return false;
if ($this->act[$this->tpi] == 'break_loop') {
$this->cancel_loop = true;
return false;
}
eval('$this->'.$this->act[$this->tpi].'();'); // LINE 190
}
if ($jump != -2)
$this->tpi = $jump;
}
# Echo a line
function do_print() {
echo $this->s;
}
... snippet
…片段
there is more too the file is there a way I can figure out where this error is actually at?
还有更多的文件有什么方法可以算出这个错误在哪里吗?
2 个解决方案
#1
2
If you want to call a function the name of which is given by $this->act[$this->tpi]
, use this:
如果要调用一个函数的名称由$this->act[$this->tpi]给出,请使用:
call_user_func(array($this, $this->act[$this->tpi]));
Don't do eval
, it is evil.
不要这样做,那是邪恶的。
#2
1
@knittl wrote : It's in line 190, which obviously contains a call to eval()" 1 min ago
@knittl写道:它在第190行,显然包含对eval()的调用。1分钟前
@knittl is correct - The error is on that line in your file. eval()'d code on line 1
means that the error is on the first line of the code that is being eval()'d on line 190 of file parser.php.
@knittl是正确的-错误在您的文件中的那一行。第1行上的eval() d代码表示错误位于文件解析器.php第190行上的eval() d代码的第一行。
Put this on the line before line 190:
把这个放在第190行之前:
echo '$this->'.$this->act[$this->tpi].'();';
And it will show you the code that is being eval'ed that is causing the error.
它会告诉你正在发生的代码正在引起错误。
#1
2
If you want to call a function the name of which is given by $this->act[$this->tpi]
, use this:
如果要调用一个函数的名称由$this->act[$this->tpi]给出,请使用:
call_user_func(array($this, $this->act[$this->tpi]));
Don't do eval
, it is evil.
不要这样做,那是邪恶的。
#2
1
@knittl wrote : It's in line 190, which obviously contains a call to eval()" 1 min ago
@knittl写道:它在第190行,显然包含对eval()的调用。1分钟前
@knittl is correct - The error is on that line in your file. eval()'d code on line 1
means that the error is on the first line of the code that is being eval()'d on line 190 of file parser.php.
@knittl是正确的-错误在您的文件中的那一行。第1行上的eval() d代码表示错误位于文件解析器.php第190行上的eval() d代码的第一行。
Put this on the line before line 190:
把这个放在第190行之前:
echo '$this->'.$this->act[$this->tpi].'();';
And it will show you the code that is being eval'ed that is causing the error.
它会告诉你正在发生的代码正在引起错误。