Symfony 2.0 を使用して、XCache と連携させようとしています。
XCache が正しくインストールされている。
公式の Symfony ドキュメントに関しては、この XcacheClassLoader.php を作成する必要があります。同じドキュメントに関して、次のようなアドバイスが得られます。
/**
* XcacheClassLoader implements a wrapping autoloader cached in Xcache for PHP 5.3.
*
* It expects an object implementing a findFile method to find the file. This
* allows using it as a wrapper around the other loaders of the component (the
* ClassLoader and the UniversalClassLoader for instance) but also around any
* other autoloader following this convention (the Composer one for instance)
*
* $loader = new ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* $cachedLoader = new XcacheClassLoader('my_prefix', $loader);
*
* // activate the cached autoloader
* $cachedLoader->register();
*
* // eventually deactivate the non-cached loader if it was registered previously
* // to be sure to use the cached one.
* $loader->unregister();
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Kris Wallsmith <kris@symfony.com>
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
*
* @api
*/
私が正しく理解していれば、autoload.php にそのコードが含まれているはずです。これは私が autoload.php でやっていることです:
通常のローダーは次のように宣言されています。
$loader = new UniversalClassLoader();
registerNamespaces、registerPrefixes などのすべての処理がその $loader に対して行われ、すべての外部依存関係が にロードされます$loader
。
$loader
->registerNamespaces(
array(
'Symfony' => array(__DIR__ . '/../vendor/symfony/src',
__DIR__ . '/../vendor/bundles'),
'Sensio' => __DIR__ . '/../vendor/bundles',
'JMS' => __DIR__ . '/../vendor/bundles',
'Doctrine\\Common' => __DIR__. '/../vendor/doctrine-common/lib',
'Doctrine\\DBAL' => __DIR__
etc...
すべての「通常の」ものが $loader に対して作成されたら、ドキュメントで述べたように、$cachedLoader を宣言します。
// register classes with namespaces
$loader->add('Symfony\Component', __DIR__.'/component');
$loader->add('Symfony', __DIR__.'/framework');
$cachedLoader = new XcacheClassLoader('my_prefix', $loader);
// activate the cached autoloader
$cachedLoader->register();
// eventually deactivate the non-cached loader if it was registered previously
// to be sure to use the cached one.
$loader->unregister();
私はそれを正しく理解していますか?明らかにそうではありません。ブラウザに表示されるのは完全に空白のページだけであり、何らかの手がかりが得られる場合に備えてログも書き込まれていないからです。
前もって感謝します。