pear - PHP Shell 相关资料

WBOY
Release: 2016-06-06 20:44:08
Original
1234 people have browsed it

用PHP写Shell脚本貌似挺冷门的吧?
不比python和ruby,资料也不好找。

有没有相关学习资料可推荐推荐呢?

  • 获得Options可以使用$argv,那我该如何获得-t选项的值?不会是取得-t的索引再用$argc[index]吧?
  • 帮助是这样 if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) { ... } 太赤祼祼了

关注这个问题和喜欢这个技术的同学可以看看这个repository
是我一边学习一边开始写的一个pear APP (一个简洁的项目管理程序)
https://github.com/supgeek-rod/PM4pear

回复内容:

用PHP写Shell脚本貌似挺冷门的吧?
不比python和ruby,资料也不好找。

有没有相关学习资料可推荐推荐呢?

  • 获得Options可以使用$argv,那我该如何获得-t选项的值?不会是取得-t的索引再用$argc[index]吧?
  • 帮助是这样 if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) { ... } 太赤祼祼了

关注这个问题和喜欢这个技术的同学可以看看这个repository
是我一边学习一边开始写的一个pear APP (一个简洁的项目管理程序)
https://github.com/supgeek-rod/PM4pear

1 先解决执行问题吧

win下面需要配置一下环境变量 总之跟java的配置差不多就是了
名称:path 值就是php目录 例如我的就是C:\php-5.5.10
然后在cmd里输入php -v 会显示版本 就说明设置成功了

linux下面安装php应该是自动配置的 如果觉得每次都要打php不爽的话 文件头加上#!/usr/local/bin/php –q

2 命令行

$_SERVER["argc"]
$_SERVER["argv"]

3 标准输入输出

<code class="lang-php">$str = fgets(STDIN);
fwrite(STDOUT, "Hello, $name!");
</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!