难道这只能用ajax做么? php出不来了。
程序员文章站
2022-05-30 22:09:30
...
//选项卡
$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 '';
//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相等后输出,但是内容不正确!
这个问题已被关闭,原因:
回复内容:
//选项卡
$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 '';
//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?