我目前的蛋糕项目是2.1.2版本。 我希望有一个{3. 1}}控制台命令,如版本3.x提供。 我如何使这个工作?
答案 0 :(得分:2)
cd /path/to/your/app/webroot/
php -S localhost:8000
相当于all the 3.x server command does。
嗯,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。
答案 1 :(得分:0)
在您的文件夹中尝试以下操作:
php -S localhost:8888 -t ./app/webroot