Heim >Backend-Entwicklung >PHP-Tutorial >难道这只能用ajax做么? php出不来了。

难道这只能用ajax做么? php出不来了。

WBOY
WBOYOriginal
2016-06-06 20:47:15888Durchsuche

<code>//选项卡
    $category['pid'] = '80';
    $this->db->order_by('id','asc');
    $data['h1s'] = $this->M->selects('category', $category, '*');
    $xuan['status'] = '1';
    $this->db->order_by('category_id','asc');
    $data['xuan'] = $this->M->selects('texts', $xuan, '*');

    //echo '<pre class="brush:php;toolbar:false">
'; //print_r($data['xuan']);exit; $i=0; foreach($data['h1s'] as $val){ $i++; //echo $key . '---' . $val['id'] . '---' . $data['xuan'][$i]['category_id'] .'
'; if($val['id'] == $data['xuan'][$i]['category_id']): echo $val['name'].'---'.$val['id'].'---'.$data['xuan'][$i]['category_id'].'---'.$data['xuan'][$i]['header'].'
'; endif; } exit; //foreach($data['h1s'] as $val){ //$i++; //echo $val[0]; //if($val['id'] == $data['xuan'][$i]['category_id']): //echo $val['id'].'---'.$data['xuan'][$i]['category_id'].'
'; //endif; //}exit; //if($data['xuan'][0]['category_id'] == $data['h1s'][0]['id']){ //foreach($data['xuan'] as $val){ //echo $data['xuan'][0]['category_id'] .'--'. $data['h1s'][0]['id'].'
'; //echo 'header:'.$data['xuan'][0]['header'].'id:'.$data['h1s'][0]['id'].'
'; //} //} //print_r($data['h1s']);exit;

用的是ci框架,我想分类的id和文章的id相等后输出,但是内容不正确!

这个问题已被关闭,原因:

回复内容:

<code>//选项卡
    $category['pid'] = '80';
    $this->db->order_by('id','asc');
    $data['h1s'] = $this->M->selects('category', $category, '*');
    $xuan['status'] = '1';
    $this->db->order_by('category_id','asc');
    $data['xuan'] = $this->M->selects('texts', $xuan, '*');

    //echo '<pre class="brush:php;toolbar:false">
'; //print_r($data['xuan']);exit; $i=0; foreach($data['h1s'] as $val){ $i++; //echo $key . '---' . $val['id'] . '---' . $data['xuan'][$i]['category_id'] .'
'; if($val['id'] == $data['xuan'][$i]['category_id']): echo $val['name'].'---'.$val['id'].'---'.$data['xuan'][$i]['category_id'].'---'.$data['xuan'][$i]['header'].'
'; endif; } exit; //foreach($data['h1s'] as $val){ //$i++; //echo $val[0]; //if($val['id'] == $data['xuan'][$i]['category_id']): //echo $val['id'].'---'.$data['xuan'][$i]['category_id'].'
'; //endif; //}exit; //if($data['xuan'][0]['category_id'] == $data['h1s'][0]['id']){ //foreach($data['xuan'] as $val){ //echo $data['xuan'][0]['category_id'] .'--'. $data['h1s'][0]['id'].'
'; //echo 'header:'.$data['xuan'][0]['header'].'id:'.$data['h1s'][0]['id'].'
'; //} //} //print_r($data['h1s']);exit;

用的是ci框架,我想分类的id和文章的id相等后输出,但是内容不正确!

算法问题,与语言无关

what the hell you are writing about?

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn