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

后端 未结 7 1944
故里飘歌
故里飘歌 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条回答
  •  猫巷女王i
    2020-12-29 14:58

    This is how you can inline PHP commands within the shell i.e. *sh:

    #!/bin/bash
    
    export VAR="variable_value"
    php_out=$(php << 'EOF'
    
    EOF)
    >&2 echo "php_out: $php_out"; #output
    

提交回复
热议问题