解析错误:语法错误,意外'而'(T_WHILE)(Parse error: syntax error, unexpected 'while' (T_WHILE))
我无法修复此错误:
Parse error: syntax error, unexpected 'while' (T_WHILE) in /xyz/xyz.php on line 76
我正在使用php 5.4.4
有人可以帮忙吗?
xyz.php 74-96行:
if (( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc( ) )) {
$process = array( &$_GET, &$_POST, &$_COOKIE, &$_REQUEST );
$val = while (list($key, $val) = each($process)) {;
[0];
$key = ;
if () {
foreach ($val as $k => $v) {
unset( $process[$key][$k] );
if (is_array( $v )) {
$process[$key][stripslashes( $k )] = $v;
$process[] = &$process[$key][stripslashes( $k )];
continue;
}
$process[$key][stripslashes( $k )] = stripslashes( $v );
}
}
unset( $$process );
}
I can't fix this error:
Parse error: syntax error, unexpected 'while' (T_WHILE) in /xyz/xyz.php on line 76
I'm using php 5.4.4
Anyone could help?
The xyz.php 74-96 Lines:
if (( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc( ) )) {
$process = array( &$_GET, &$_POST, &$_COOKIE, &$_REQUEST );
$val = while (list($key, $val) = each($process)) {;
[0];
$key = ;
if () {
foreach ($val as $k => $v) {
unset( $process[$key][$k] );
if (is_array( $v )) {
$process[$key][stripslashes( $k )] = $v;
$process[] = &$process[$key][stripslashes( $k )];
continue;
}
$process[$key][stripslashes( $k )] = stripslashes( $v );
}
}
unset( $$process );
}
原文:https://stackoverflow.com/questions/20616570
更新时间:2019-12-03 00:42
最满意答案
while是一种语言结构,但你不能从以下方面获取返回值:
$val = while ( ... ) { ... }
^^^^^^---invalid
它应该是公正的
while (...) { ... }
while is a language construct, and is NOT something you can capture a return value from:
$val = while ( ... ) { ... }
^^^^^^---invalid
It should be just
while (...) { ... }
2013-12-16
相关问答
解析错误在这里: echo "Watching ".static::$favSport;
是因为后期静态绑定是在PHP v5.3中引入的。 你的PHP版本(<5.3)不能识别static::$favSport 。 除了使用对象继承(除了对象继承之外,它本身并不是一个修复 ,因为它与static没有任何关系),所以我没有办法想办法修复它比5.3更早的PHP。 The parse error here: echo "Watching ".static::$favSport;
is because
...
while是一种语言结构,但你不能从以下方面获取返回值: $val = while ( ... ) { ... }
^^^^^^---invalid
它应该是公正的 while (...) { ... }
while is a language construct, and is NOT something you can capture a return value from: $val = while ( ... ) { ... }
^^^^^^---invalid
It should
...
if只能是一个声明:你用它作为表达式 。 它不会返回任何内容,并且不能在其他语句中使用。 但是,您可以使用三元运算符来完成此操作: . ( isset ($_POST['idSearch']) ? " WHERE a.id = " . $_POST['idSearch'] : '')
这说“如果设置$_POST['idSearch'] ,添加该字符串,否则,添加空字符串。 请注意,你应该真的看看你的代码,因为在我上面发布的代码中有一个明显的SQL注入。 任何人都可以在数据库上执行任意代码。
...
尝试添加一个; 在JS函数的文本末尾 <?php
echo "function delayer(){ window.location = 'peoplelist.html'; }";
?>
Try and add a ; to the end of your text in your JS function <?php
echo "function delayer(){ window.location = 'peoplelist.html'; }";
?>
除了echo线上的语法错误之外,导致此特定错误的实际问题是您只能使用常量初始化类成员 。 由于常量永远不会以$开头,因此您的初始化会出现语法错误。 你必须在类的构造函数中分配给那些成员 ,就像你为$db做的那样。 Aside from a syntax error on your echo line, the actual problem resulting in this particular error is that you can only initialise class members
...
删除' : <?php
$name = 'John Doe';
echo 'My name is $name';
echo "I am from $_COOKIE[mylocation]";
谨防XSS漏洞 ! Remove the ': <?php
$name = 'John Doe';
echo 'My name is $name';
echo "I am from $_COOKIE[mylocation]";
Beware of XSS vulnerabili
...
问题是您正在尝试使用spl_autoload_register()注册匿名函数,但正如您所说,您在Web服务器上使用PHP5.2。 不幸的是,PHP <5.3不支持匿名功能。 你需要写一个“常规”函数: function my_autoload($class) {
require_once 'classes/' . $class . '.php';
}
spl_autoload_register('my_autoload');
这也适用于PHP> = 5.3。 The problem
...