示例#1
0
文件: test.php 项目: lughong/test
 public function setSearch()
 {
     //添加搜索
     XSD::setSearch();
 }
示例#2
0
文件: friend.php 项目: lughong/test
 public function search()
 {
     $friendname = isset($_POST['friendname']) ? htmlspecialchars(trim($_POST['friendname'])) : '';
     $uid = User::getLoginUid();
     if (!$friendname || !$uid) {
         echo "0";
         throw new Exception('exit');
     }
     //利用xs来搜索
     $xs = XSD::getXS();
     $search = $xs->search;
     $user_info = $xs->setLimit(10)->search(trim($friendname));
     if ($user_info) {
         $return_info = '<ul class="list addf"><li>';
         foreach ($user_info as $key => $value) {
             $url = url("myweb", "friend::ajaxaddfriend", $value['id']);
             $return_info .= '<a href="' . $url . '" class="addfriendact">' . $value['username'] . '</a>';
         }
         $msg['err'] = '1';
         $msg['msg'] = $return_info . "</li></ul>";
     } else {
         $msg['err'] = '0';
         $msg['msg'] = '<ul class="list addf"><li><a>没有符合条件的好友</a></li></ul>';
     }
     echo json_encode($msg);
     throw new Exception('exit');
 }