<?PHP
$dir=dir('./');
while($entry=$dir->read()){
if(!is_file($entry)) {continue;}
$handle=fopen($entry,"r");
while($buffer=fgets($handle,4096)){
$buffer=trim($buffer);
if(ereg("title*=*\"",$buffer)){
eval ($buffer);
$linknm=$title;
break;
}
}
}
?>
请问这个代码的eval()有什么问题?
怎么老是提示错误:Parse error: syntax error, unexpected '<' in D:\AppServ\www\navbar.inc(10) : eval()'d code on line 1
$dir=dir('./');
while($entry=$dir->read()){
if(!is_file($entry)) {continue;}
$handle=fopen($entry,"r");
while($buffer=fgets($handle,4096)){
$buffer=trim($buffer);
if(ereg("title*=*\"",$buffer)){
eval ($buffer);
$linknm=$title;
break;
}
}
}
?>
请问这个代码的eval()有什么问题?
怎么老是提示错误:Parse error: syntax error, unexpected '<' in D:\AppServ\www\navbar.inc(10) : eval()'d code on line 1
Evaluates the string given in code_str as PHP code. Among other things, this can be useful for storing code in a database text field for later execution. There are some factors to keep in mind when using eval(). Remember that the string passed must be valid PHP code, including things like terminating statements with a semicolon so the parser doesn't die on the line after the eval(), and properly escaping things in code_str . To mix HTML output and PHP code you can use a closing PHP tag to leave PHP mode. Also remember that variables given values under eval() will retain these values in the main script afterwards.