`
sillycat
  • 浏览: 2542958 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

PHP Command Line Tool

 
阅读更多
PHP Command Line Tool

Recently, work with my colleague and find out a very useful PHP tool.

Here is how I install that
> wget https://psysh.org/psysh
> chmod +x psysh
> ./psysh

Then in the command line tool, I can connect to my mysql with PDO
Psy Shell v0.9.9 (PHP 7.1.23 — cli) by Justin Hileman
>>> $dbh = new PDO('mysql:host=167.99.xxx.xxx;port=4006;dbname=xxxx’,’user’,'password');

Put that into the PATH even better
> sudo mv ./psysh /opt/local/bin/

Then I can run PHP command line in the tool
> psysh
Psy Shell v0.9.9 (PHP 7.2.12 — cli) by Justin Hileman
>>> $hello = 'Hello';
=> "Hello"
>>> $hello .= ' world!';
=> "Hello world!"
>>> echo $hello;
Hello world!⏎
>>> exit
Exit:  Goodbye


References:
https://blog.csdn.net/zhanghao143lina/article/details/70183698
https://github.com/bobthecow/psysh
https://segmentfault.com/a/1190000008427477
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics