我想询问关于CI的html请求,所以我有一些问题。
<?php foreach($data_gw as $user){ ?> <td><?php $user->dt_request_pod; ?></td> <?php } ?> <br> <?php $test_time = $user->dt_request_pod; ?> <br> <?php $new_time = date('Y-m-d H:i:s',strtotime('1 seconds',strtotime($test_time))); echo $new_time; ?>
现在我想获得$ new_time变量(使用CI上的重定向)并在我的控制器上获取该变量,例如
redirect('localhost/2ndpage.php?id=123')
非常感谢你的帮助
http://abcde.com/api/pod/gettrackpartnerresi?key=CD8B025D3335477A8C779FB8BC65FEB8&afterdatetime=2017-07-13
答案 0 :(得分:0)
修复我有其他方式
控制器上的
> public function get_date($new_time) {
>
> $data1['mydate'] = $new_time; $this->load->view('menu');
> $this->load->view('page1',$data1);
>
>
> ////test json request
>
> $data = array
>
> (
> 'cabang' => '1',
> 'key' => 'a',
> 'kode_cabang' => 'b',
> 'kodecaodoo'=> '',
> 'kodestatus'=>'',
> 'name'=>'',
> 'noresi'=>'',
> 'note'=>'',
> 'trackingdatetime'=>''
> );
>
> $data_string = json_encode($data);
>
> $curl = curl_init('http://mysite.com.ap-southeast-1.compute.xxx.com:8084/api/pod/gettrack');
>
> curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
>
> curl_setopt($curl, CURLOPT_HTTPHEADER, array(
> 'Content-Type: application/json',
> 'Content-Length: ' . strlen($data_string))
> );
>
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Make it so the data coming back is put into a string
> curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string); // Insert the data
>
> // Send the request
> $result = curl_exec($curl);
>
> // Free up the resources $curl is using
> curl_close($curl);
>
> echo $result;
>
>
>
> }
然后在我的观点上发布
echo $ mydate