我的客户说他使用我的脚本得到了这个错误:
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
Run Code Online (Sandbox Code Playgroud)
34号线header.php就是use \Main\Class;
现在,我告诉他他必须拥有PHP >= 5.3.0,他说他的PHP版本是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();
Run Code Online (Sandbox Code Playgroud)
编辑2:
他发给我了这个:
Program Version
Apache: 2.2.24
CentOS: CentOS release 6.4 (Final)
cPanel: 11.36.1 (build 8)
Curl: 7.12.1
MySQL …Run Code Online (Sandbox Code Playgroud) 我将我的网站从本地移动到托管,我发生了一些事情.我把这个配置文件包含在我的index.php(这是我做的第一件事)中:
<?php
require_once __DIR__.'/../../vendor/autoload.php';
// some other stuff
$app = new Silex\Application();
$app['debug'] = true;
$defaultLocale = 'en';
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => array(
__DIR__.'/../views',
__DIR__.'/../views/backend',
__DIR__.'/../views/layouts',
__DIR__.'/../views/components',
__DIR__.'/../views/backend/components',
),
));
$app->register(new Nicl\Silex\MarkdownServiceProvider());
Run Code Online (Sandbox Code Playgroud)
但网站抱怨这样:
警告:输入中出现意外的字符:第7行的/public_html/_inc/config.php中的'\'(ASCII = 92)状态= 1
解析错误:语法错误,第7行/public_html/_inc/config.php中的意外T_STRING
基本上,第7行是$app = new Silex\Application();.我正在使用Silex,服务器正在运行PHP 5.2.供应商文件夹(包含所有框架和第三方的东西)在root(/)中
我想知道它有自动加载的一些问题,但我找不到究竟是什么或如何测试它.你觉得有什么奇怪的吗?提前致谢.