我需要从任何位置运行CodeIgniter项目,而无需在WAMP服务器的目录(www)上替换它。因此,我想为此使用CLI和Composer。
对于Composer自动加载,我遵循link中的这些说明。
这是我的配置文件:
$config['composer_autoload'] = TRUE;
还有我的
composer.json
:"config": {
"vendor-dir": "application/vendor"
},
之后,我运行
composer update
来创建vendor/
文件夹。但是,当我尝试使用CLI运行项目时,如下所示:
php index.php MYController_1 Methode_1
无需通过Web浏览器打开和运行Web应用程序,而是将该页面的源代码打印到控制台。
Laravel的CodeIgniter的
php artisan serve
等效于什么?
最佳答案
拉拉韦尔php artisan serve
是how Laravel starts a local development server:
Serving Laravel
Typically, you may use a web server such as Apache or Nginx to serve your Laravel applications. If you are on PHP 5.4+ and would like to use PHP's built-in development server, you may use the
serve
Artisan command:php artisan serve
CodeIgniter v3
CodeIgniter版本3没有与此等效的命令,但是您可以使用PHP的内置网络服务器as Lázaro suggests:
php -S localhost:8000 index.php
CodeIgniter v4
如果使用的是CodeIgniter版本4,则可以启动其本地开发服务器with
php spark serve
。该文档将命令名称弄错了,但是在其他方面很有帮助,因此我在此处将其包含在固定命令中:Local Development Server
PHP provides a built-in web server that is can be used locally when developing an application without the need to setup a dedicated web server like MAMP, XAMPP, etc. If you have PHP installed on your development machine, you can use the
serve
script to launch PHP’s built-in server and have it all setup to work with your CodeIgniter application. To launch the server type the following from the command line in the main directory:php spark serve
This will launch the server and you can now view your application in your browser at http://localhost:8080.
Note
The built-in development server should only be used on local development machines. It should NEVER be used on a production server.
关于php - CodeIgniter项目的 "php artisan serve"等价于什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50031085/