内容简介:翻译自:https://stackoverflow.com/questions/6231991/run-php-function-inside-bash-and-keep-the-return-in-a-bash-variable
我试图在Bash中运行 PHP
函数…但它无法正常工作.
#! /bin/bash /usr/bin/php << 'EOF' <?php echo getcwd(); ?> EOF
在现实中,我需要将返回值保存在bash变量中……顺便说一下,我使用 php 的getcwd()函数来说明bash操作.
更新:有没有办法传递变量?
VAR='/$#' php_cwd=`/usr/bin/php << 'EOF' <?php echo preg_quote($VAR); ?> EOF` echo "$php_cwd"
有任何想法吗?
php_cwd=`/usr/bin/php << 'EOF' <?php echo getcwd(); ?> EOF` echo "$php_cwd" # Or do something else with it
翻译自:https://stackoverflow.com/questions/6231991/run-php-function-inside-bash-and-keep-the-return-in-a-bash-variable
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Golang 函数变量
- 【项目实用】Css 变量及函数
- 015.Python函数名的使用以及函数变量的操作
- Shell编程—【04】函数的定义、参数、变量作用域、函数库
- JS变量声明和函数声明提升
- golang学习笔记(一):包,变量,函数
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
The Creative Curve
Allen Gannett / Knopf Doubleday Publishing Group / 2018-6-12
Big data entrepreneur Allen Gannett overturns the mythology around creative genius, and reveals the science and secrets behind achieving breakout commercial success in any field. We have been s......一起来看看 《The Creative Curve》 这本书的介绍吧!