如何检查Codeigniter是否设置了$ data变量? [英] How to check if $data variable is set with Codeigniter?
本文介绍了如何检查Codeigniter是否设置了$ data变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我设置 $ data ['say_something'] ='Hello';
之类的数据,并使用 $ this-将其发送到视图时> load-> view('my_page',$ data);
,如何检查视图中是否设置了变量$ say_something?
When I set a data like $data['say_something'] = 'Hello';
and send it to the view with $this->load->view('my_page', $data);
, how can I check in the view if the variable $say_something is set? Is there a Codeigniter function to this or something?
推荐答案
这里与Codeigniter无关。这是基本的 PHP
。
There is nothing to do with codeigniter here. It's basic PHP
.
if(isset($say_something)){
echo $say_something;
}
else{
echo "variable is not there";
}
这篇关于如何检查Codeigniter是否设置了$ data变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文