Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我正在使用CodeIgniter,并试图根据查询返回设置一个变量_Php_Codeigniter - Fatal编程技术网

Php 我正在使用CodeIgniter,并试图根据查询返回设置一个变量

Php 我正在使用CodeIgniter,并试图根据查询返回设置一个变量,php,codeigniter,Php,Codeigniter,我可以使用打印并返回此数据: Array ( [array] => Array ( [status] => false [message] => The %s subscription code is out of date. ) ) 我需要能够将元素“状态”和“消息”设置为变量。(在本例中status=false)如果我理解正确,是否希望$status和$message保存相应的值 $input = array(

我可以使用打印并返回此数据:

Array ( 
    [array] => Array ( 
        [status] => false 
        [message] => The %s subscription code is out of date. 
    ) 
)

我需要能够将元素“状态”和“消息”设置为变量。(在本例中status=false)

如果我理解正确,是否希望
$status
$message
保存相应的值

$input = array(
    'status' => false,
    'message' => 'The %s subscription code is out of date.'
);

$output = array();
foreach ($input as $key => $value) {
    $$key = $value; // assign $value using variable variable
}

print($status); // prints nothing because it's false
print($message); // The %s subscription code is out of date.

如果我理解正确,是否希望
$status
$message
保存相应的值

$input = array(
    'status' => false,
    'message' => 'The %s subscription code is out of date.'
);

$output = array();
foreach ($input as $key => $value) {
    $$key = $value; // assign $value using variable variable
}

print($status); // prints nothing because it's false
print($message); // The %s subscription code is out of date.
$data=array(
“状态”=>“错误”,
'消息'=>'%s订阅代码已过期。'
);
提取(数据);
echo$status;//输出“false”,因为如果您的状态为字符串。
回声“
”; echo$message;//输出%s订阅代码已过期。
是一个非常流行的函数,它将数组中的元素转换为其自身格式的变量( “状态”=>“错误”, '消息'=>'%s订阅代码已过期。' ); 提取(数据); echo$status;//输出“false”,因为如果您的状态为字符串。 回声“
”; echo$message;//输出%s订阅代码已过期。
是一个非常流行的函数,它可以将数组中的元素按其自身的格式转换为变量。请提供使您走到这一步的代码。请提供使您走到这一步的代码。整洁!我不知道
extract()
-我更喜欢你的方法。整洁!我不知道
extract()
-我更喜欢你的方法。