Kor*_*lis 13 php namespaces autoload silex
我将我的网站从本地移动到托管,我发生了一些事情.我把这个配置文件包含在我的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(/)中
我想知道它有自动加载的一些问题,但我找不到究竟是什么或如何测试它.你觉得有什么奇怪的吗?提前致谢.