luoer
V2EX  ›  编程

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

  •  
  •   luoer · Nov 23, 2015 · 5654 views
    This topic created in 4021 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   ·   1204 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 17:39 · PVG 01:39 · LAX 09:39 · JFK 12:39
    ♥ Do have faith in what you're doing.