有交互式cakephp控制台吗?

时间:2022-04-08 20:25:06

For those that are familiar with Rails, you can do

对于那些熟悉Rails的人,你可以做到

script/console

in the root of an app, and you'll get an interactive shell that has all your app code loaded, where you can enter Ruby expressions, and their results will get printed on the next line.

在应用程序的根目录中,您将获得一个交互式shell,其中包含所有应用程序代码,您可以在其中输入Ruby表达式,其结果将打印在下一行。

Is there something like that in Cakephp, or is console just for scripts? If not, could you theoretically build such a thing on top of the console? I'm not sure, because I'm not too familiar with PHP.

在Cakephp中有类似的东西,还是仅用于脚本的控制台?如果没有,你理论上可以在控制台上构建这样的东西吗?我不确定,因为我对PHP不太熟悉。

3 个解决方案

#1


This is mine. I'm not familiar w/ the Rails version, but I think it's pretty similar. http://github.com/mcurry/interactive

这是我的。我对Rails版本并不熟悉,但我认为它非常相似。 http://github.com/mcurry/interactive

#2


There is not a peer to the rails console. Cake does have the idea of shells, which can be used for writing scripts, really more a peer to the runner in rails than to the console. One example of a CakePHP shell is the executable bake, which does much of the auto-generation.

rails控制台没有对等端。 Cake确实有shell的想法,可以用来编写脚本,实际上更多的是在rails中的运行程序而不是控制台。 CakePHP shell的一个例子是可执行的烘焙,它可以完成很多自动生成。

#3


I believe running script/console just launches irb and bootstraps in your Rails application code.

我相信运行脚本/控制台只需在您的Rails应用程序代码中启动irb和bootstraps。

PHP5 now has an interactive shell (php -a) so maybe we might see something like this in the future.

PHP5现在有一个交互式shell(php -a)所以也许我们将来可能会看到这样的东西。

I am not sure how well PHP5's native interactive shell stacks up against PHP_Shell available from PEAR.

我不确定PHP5的本机交互式shell是如何与PEAR提供的PHP_Shell进行叠加的。

#1


This is mine. I'm not familiar w/ the Rails version, but I think it's pretty similar. http://github.com/mcurry/interactive

这是我的。我对Rails版本并不熟悉,但我认为它非常相似。 http://github.com/mcurry/interactive

#2


There is not a peer to the rails console. Cake does have the idea of shells, which can be used for writing scripts, really more a peer to the runner in rails than to the console. One example of a CakePHP shell is the executable bake, which does much of the auto-generation.

rails控制台没有对等端。 Cake确实有shell的想法,可以用来编写脚本,实际上更多的是在rails中的运行程序而不是控制台。 CakePHP shell的一个例子是可执行的烘焙,它可以完成很多自动生成。

#3


I believe running script/console just launches irb and bootstraps in your Rails application code.

我相信运行脚本/控制台只需在您的Rails应用程序代码中启动irb和bootstraps。

PHP5 now has an interactive shell (php -a) so maybe we might see something like this in the future.

PHP5现在有一个交互式shell(php -a)所以也许我们将来可能会看到这样的东西。

I am not sure how well PHP5's native interactive shell stacks up against PHP_Shell available from PEAR.

我不确定PHP5的本机交互式shell是如何与PEAR提供的PHP_Shell进行叠加的。