我如何获得版本 2.1.2 的 cakephp 服务器命令
How do i get the cakephp server command for version 2.1.2
我现在的蛋糕项目是2.1.2版本。
我想要 server
版本 3.x 提供的控制台命令。
我如何让它工作?
不需要cli
cd /path/to/your/app/webroot/
php -S localhost:8000
相当于all the 3.x server command does.
反正我想要一个cli
嗯,cli 很简单。所以你只需要创建一个命令来做同样的事情,原则上:
// app/Console/Command/ServerShell.php
<?php
App::uses('AppShell', 'Console/Command');
class ServerShell extends AppShell
{
public function main()
{
$command = sprintf(
"php -S %s:%d -t %s %s",
'localhost',
8080,
escapeshellarg(WWW_ROOT),
escapeshellarg(WWW_ROOT . '/index.php')
);
system($command);
}
}
请注意,这仅适用于 php 的 5.4+ 版本,如 that's when the inbuilt webserver was introduced。
在您的文件夹中试试这个:
php -S localhost:8888 -t ./app/webroot
我现在的蛋糕项目是2.1.2版本。
我想要 server
版本 3.x 提供的控制台命令。
我如何让它工作?
不需要cli
cd /path/to/your/app/webroot/
php -S localhost:8000
相当于all the 3.x server command does.
反正我想要一个cli
嗯,cli 很简单。所以你只需要创建一个命令来做同样的事情,原则上:
// app/Console/Command/ServerShell.php
<?php
App::uses('AppShell', 'Console/Command');
class ServerShell extends AppShell
{
public function main()
{
$command = sprintf(
"php -S %s:%d -t %s %s",
'localhost',
8080,
escapeshellarg(WWW_ROOT),
escapeshellarg(WWW_ROOT . '/index.php')
);
system($command);
}
}
请注意,这仅适用于 php 的 5.4+ 版本,如 that's when the inbuilt webserver was introduced。
在您的文件夹中试试这个:
php -S localhost:8888 -t ./app/webroot