Create php file with content from terminal

こ雲淡風輕ζ 提交于 2020-01-06 06:40:19

问题


I was wondering how, for example, cakePHP can use the terminal/command line to create files and put content in it. I guess they use some kind of template for the content but how do they do it?

I know that you can create controllers and so on with it. Anyone know how it's done?

/ Tobias

EDIT: I've been searching and searching but can't find anything about this. Please is there anyone who can help me with this?


回答1:


You can use templates for easy to create files or something like Zend_CodeGenerator for a more elaborate approach. Apart from that, have a look at the sourcecode for CakePHP's bake if you are specifically interested in how they do it.



来源:https://stackoverflow.com/questions/2153276/create-php-file-with-content-from-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!