我一直在遵循这个教程使用Zend Framework 1与composer- http://adamcod.es/2013/05/10/composer-and-zend-framework-1.x.html
我下载并安装了ZF1作为依赖项,然后重写index.php查看vendor/zendframework/zendframework1/library/目录中的Zend库(而不是library/)。我可以通过进入localhost/zend-composer/public/
来确认这是OK的然而,当我启动PHP服务器php -S 127.0.0.1:8000
时,它告诉我The requested resource / was not found on this server.
,因为它正在根目录中查找。
我对PHP服务器有点陌生,也许我需要配置一些东西?如果有任何建议,我将不胜感激。谢谢。
您可以为公共目录使用-t选项
php -S 127.0.0.1:8000 -t web/
对于zend,以下工作
php -S 127.0.0.1:8000 -t public/
这种做法在ZF2中很常见——同时定义document_root和router
很重要php -S 0.0.0.0:8000 -t public public/index.php
其中-t public
将document_root定义为公共目录
和public/index.php
定义路由脚本,所有的请求将被传递到脚本(通常由apache中的mod_rewrite
定义)。