luoer
V2EX  ›  编程

shell 脚本中 执行 php 脚本 如何让 shell 获取到 php 执行结果

  •  
  •   luoer · Nov 23, 2015 · 5668 views
    This topic created in 4030 days ago, the information mentioned may be changed or developed.

    如题,请各位指点一下。

    3 replies  •  2015-11-23 11:24:12 +08:00
    fising
    fising
    Nov 23, 2015
    1
    ``
    luoer
    luoer
    OP
    Nov 23, 2015
    2
    @fising 谢谢!我试一下
    fising
    fising
    Nov 23, 2015
    3
    output=`php demo.php`

    或

    output=$(php demo.php)

    然后

    echo $output
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1846 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 11:50 · PVG 19:50 · LAX 03:50 · JFK 06:50
    ♥ Do have faith in what you're doing.