luoer
V2EX  ›  编程

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

  •  
  •   luoer · Nov 23, 2015 · 5534 views
    This topic created in 3932 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   ·   2959 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 06:25 · PVG 14:25 · LAX 23:25 · JFK 02:25
    ♥ Do have faith in what you're doing.