输入中的意外字符:"\"(ASCII = 92)状态= 1 [英] Unexpected character in input: '\' (ASCII=92) state=1

查看:387
本文介绍了输入中的意外字符:"\"(ASCII = 92)状态= 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户说他正在使用我的脚本收到此错误:

My client says he is getting this error using my script:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /path/to//header.php  on line 34
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in/path/to/header.php  on line 34

header.php中的第34行只是use \Main\Class;

现在,我告诉他他必须拥有PHP >= 5.3.0,他说他的PHP版本是5.3.24

Now, I told him he has to have PHP >= 5.3.0 and he says his PHP version is 5.3.24

可能是什么问题?

之前和之后的行

30. // Define absolute path
31. define("ABSPATH", $abs_path);
32. $_SESSION["abs_path"] = ABSPATH;
33. 
34. use \CNS\main\CNS;
35. $cns = new CNS();

他给我发了这个

Program     Version
Apache:     2.2.24
CentOS:     CentOS release 6.4 (Final)
cPanel:     11.36.1 (build 8)
Curl:       7.12.1
MySQL       5.5.30
phpMyAdmin  3.5.5
Python:     2.6.6
Program     Version
Perl:       5.8.8
**PHP:        5.3.24**
ionCube Loader:     4.2.2
Zend Optimizer:     3.3.9
Ruby:       1.8.7
Rails:      3.2.8
OpenSSL:    1.0.0-fips

推荐答案

如果您尝试使用名称空间但没有PHP 5.3,则会发生这种情况. PHP 5.2和更低版本不支持名称空间,并且在看到反斜杠时会抛出此错误.

This happens if you are trying to use namespaces but do not have PHP 5.3. PHP 5.2 and below don't support namespaces and throw this error when they see the backslash.

- 混合版本.如果我没记错的话,则是5.2及以下版本没有名称空间.

-- mixed up the versions. It's 5.2 and below that don't have namespaces, if I'm not mistaken.

这篇关于输入中的意外字符:"\"(ASCII = 92)状态= 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆