我的PHP代码如下:
$data['details'] = $this->category_model->edit_category($id);
print "<pre>"; print_r($data); die;
当我使用打印时,我的输出是:
Array
(
[details] => stdClass Object
(
[id] => 31
[c_parent_id] => 3
[c_name] => Sandles
)
)
我想访问“c_name”。如何访问它?
答案 0 :(得分:1)
这将打印值:
response = client.call(:set_execution_parameters, :soap_header => { :session_id => sid })
答案 1 :(得分:1)
$data['details']->c_name; would give value of c_name
答案 2 :(得分:0)
当您需要从控制器获取变量以进行查看时
文件名:Example.php
<?php
class Example extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('category_model');
}
public function index(){
$data['details'] = $this->category_model->edit_category($id);
$this->load->view('details_view', $data);
}
}
观看
<?php echo $details->c_name;?>