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

后端 未结 7 1885
故里飘歌
故里飘歌 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 14:59

    Use '-R' of php command line. It has a build-in variable that reads inputs.

    VAR='/$#'
    php_cwd=$(echo $VAR | php -R 'echo preg_quote($argn);')
    echo $php_cwd
    

提交回复
热议问题