2016-01-24 05:14
浏览 105


I want to be able to type into the command line, and have the following PHP script execute like so:

$ hello.php

Question is, where do I save my hello.php file to run it like this. I see a lot of tutorials showing this way, but they do not mention where to save the actual file. If I save it on my desktop then it will run when I type in:


I want to be able to just type in the file name regardless of what directory I'm in and have it execute.

Do I have to setup an alias? Or can I just put it in a specific folder.



echo 'Hello! This is a test';

图片转代码服务由CSDN问答提供 功能建议


  $ hello.php 

问题是,我在哪里保存 hello.php 文件像这样运行它。 我看到很多教程都以这种方式显示,但他们没有提到保存实际文件的位置。 如果我将它保存在我的桌面上,那么当我输入时它会运行:

 〜/ Desktop / hello.php 
 \  n 


我是否必须设置别名? 或者我可以把它放在一个特定的文件夹中。


echo'你好! 这是一个测试'; 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题