luoer
V2EX  ›  编程

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

  •  
  •   luoer · Nov 23, 2015 · 5539 views
    This topic created in 3939 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   ·   Privacy   ·   Solana   ·   2947 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 14:51 · PVG 22:51 · LAX 07:51 · JFK 10:51
    ♥ Do have faith in what you're doing.