Zend 框架安装 xampp 错误

Zend Framework Installation on xampp errors

我正在尝试在 xampp 上安装 zend,但我不断遇到错误。

首先我得到:

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php on line 24

第24行如下:

if (! class_exists(Application::class)) {

我通过将 Application::class 设为字符串来解决这个问题。

然后我得到了下面的第二个错误:

Warning: include(C:\xampp\htdocs\zend\ZendSkeletonApplication\public/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php on line 22

Warning: include(): Failed opening 'C:\xampp\htdocs\zend\ZendSkeletonApplication\public/../vendor/autoload.php' for inclusion (include_path='.;\xampp\php\PEAR') in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php on line 22

Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load application. - Type composer install if you are developing locally. - Type vagrant ssh -c 'composer install' if you are using Vagrant. - Type docker-compose run zf composer install if you are using Docker. ' in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php:25 Stack trace: #0 {main} thrown in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php on line 25

我应该在哪里找到包含自动加载页面的供应商文件夹?我今天会撒谎解决它,哈哈,我已经尝试了好几天了。

提前感谢您的帮助

使用 Composer 是安装 Zend Framework 的推荐方法(这会创建 vendor 文件夹)。就个人而言,我从来没有使用 Windows 完成过此操作,但这里有一些说明应该有所帮助:https://docs.zendframework.com/tutorials/getting-started/skeleton-application/#windows-users-using-wamp

从您问题中的第一条错误消息来看,您 运行ning 的 PHP 版本对于 运行 ZF 的当前版本来说太低了,所以您可能需要先升级 PHP。 (Composer 通常会在安装期间告诉您。)