Exemplo n.º 1
0
 public function searchitem()
 {
     //根据内容识别搜索类型
     //判断是否数字
     //如果是数字,搜索barcode
     //如果是字符串,搜索名称、品牌和功效
     $db = D($this->_table);
     $key = I('post.key', 0, 'intval');
     $items = array();
     if ($key != 0) {
         $items = $db->where("barcode = %d", $key)->select();
     } else {
         $key = I('post.key', '', 'strip_tags');
         $key = '%' . stringCheck($key) . '%';
         $map['name|alias'] = array('like', '%' . $key . '%');
         if ($key != '') {
             $items = $db->where($map)->select();
         }
     }
     $this->assign("items", $items);
     $this->display();
 }
Exemplo n.º 2
0
 public function searchitem()
 {
     //根据内容识别搜索类型
     //判断是否数字
     //如果是数字,搜索barcode
     //如果是字符串,搜索名称、品牌和功效
     $db = D($this->modelName);
     $key = I('post.key', 0, 'intval');
     $items = array();
     if ($key != 0) {
         $items = $db->where("barcode = %d", $key)->select();
     } else {
         $key = I('post.key', '', 'strip_tags');
         $key = stringCheck($key);
         var_dump($key);
         if ($key != '') {
             $items = $db->where("name like '%{$key}%' or function like '%{$key}%'")->select();
         }
     }
     $this->assign("items", $items);
     $this->display();
 }
Exemplo n.º 3
0
 public function searchitem()
 {
     //根据内容识别搜索类型
     //判断是否数字
     //如果是数字,搜索barcode
     //如果是字符串,搜索名称、品牌和功效
     $db = D('BestForBaby');
     $key = I('post.key', 0, 'intval');
     $items = array();
     if ($key != 0) {
         $items = $db->where("barcode = %d", $key)->select();
     } else {
         $key = I('post.key');
         //,'','strip_tags');
         $key = '%' . stringCheck($key) . '%';
         $map['name|brand|corp'] = array('like', '%DDR%');
         if ($key != '') {
             //$items =$db->where("name like '%$key%' or brand like '%$key%'")->select();
             $items = $db->where($map)->select();
         }
     }
     $this->assign("items", $items);
     $this->display();
 }
?>
</p>
	<p><?php 
echo $getal1;
?>
 * <?php 
echo $getal2;
?>
 = <?php 
echo vermenigvuldig($getal1, $getal2);
?>
</p>
	<p><?php 
echo $getal1;
?>
 is <?php 
echo isEven($getal1) ? "even" : "oneven";
?>
</p>
	<p>"<?php 
echo $stringToCheck;
?>
" is <?php 
echo stringCheck($stringToCheck)["lengte"];
?>
 lang en "<?php 
echo stringCheck($stringToCheck)["uppercase"];
?>
" in uppercase.</p>
</body>
</html>