84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
原来都是php xxx.php 来运行这个php脚本
在linux系统想使用./xxx.sh来代替上面
不知是否可行?
ringa_lee
可行的,
#!/bin/bash # author: gm100861 PHP=/usr/local/php/bin/php $PHP youphpfilename.php
你是想直接执行php脚本吧
1.在xxx.php开头加上 #!/usr/local/php/bin/php 2.chmod +x xxx.php 3. ./xxx.php
那看你用的是那种shell。
如果是bash,那没什么好办法,无非将文件名传给shell,然后调用php运行。
如果是zsh,可以编辑.zshrc,使用 alias -s 命令,指定当你直接输入*.php时用何种命令执行。例如:alias -s php='php' #在shell输入*.php时运行alias -s php='vim' #在shell输入*.php时打开alias -s php='php -l' #在shell输入*.php时检查语法错误
可以啊,shell脚本里面一样调用php ***.php还可以通过crontab来指定执行时间和周期
php ***.php
http://segmentfault.com/q/1010000003731015/a-1020000003732913
可行的,
你是想直接执行php脚本吧
那看你用的是那种shell。
如果是bash,那没什么好办法,无非将文件名传给shell,然后调用php运行。
如果是zsh,可以编辑.zshrc,使用 alias -s 命令,指定当你直接输入*.php时用何种命令执行。例如:
alias -s php='php' #在shell输入*.php时运行
alias -s php='vim' #在shell输入*.php时打开
alias -s php='php -l' #在shell输入*.php时检查语法错误
可以啊,shell脚本里面一样调用
php ***.php
还可以通过crontab来指定执行时间和周期
http://segmentfault.com/q/1010000003731015/a-1020000003732913