luoer
V2EX  ›  编程

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

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

    如题,请各位指点一下。

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



    output=$(php demo.php)

    然后

    echo $output
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1205 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 17:34 · PVG 01:34 · LAX 10:34 · JFK 13:34
    ♥ Do have faith in what you're doing.