Run PHP function inside Bash (and keep the return in a bash variable)

后端 未结 7 1941
故里飘歌
故里飘歌 2020-12-29 14:35

I am trying to run a PHP function inside Bash... but it is not working.

#! /bin/bash

/usr/bin/php << \'EOF\'

EOF
         


        
7条回答
  •  青春惊慌失措
    2020-12-29 15:03

    Alternatively:

    php_cwd = `php -r 'echo getcwd();'`
    

    replace the getcwd(); call with your php code as necessary.

    EDIT: ninja'd by David Chan.

提交回复
热议问题