[英]PHP Return in function Fedex
Dont know if I should add to this post or not but it is kind of relevant I think不知道我是否应该添加到这篇文章中,但我认为这有点相关
This works just fine这工作得很好
function getProperty($var)
{
if($var == 'check')
Return true;
if($var == 'shipaccount')
Return '286096425543324';
But this does not?但这不? How would one enter a如何进入
$fedex_account = "286096425543324";
function getProperty($var)
{
if($var == 'check')
Return true;
if($var == 'shipaccount')
Return '$fedex_account';
'$fedex_account'
Single quotes don't expand variables.单引号不会扩展变量。 Just do this:只需这样做:
function getProperty($var){
// You need this if $fedex_account is a global variable
global $fedex_account;
if($var == 'check') Return true;
if($var == 'shipaccount') Return $fedex_account;
Read about Visibility - $fedex_account
are in other scope.了解可见性- $fedex_account
在其他 scope 中。
and about quotes .以及关于报价。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.