Example #1
0
 /**
  * 用户注册信息存入
  * @param  [type] $email    [description]
  * @param  [type] $username [description]
  * @param  [type] $password [description]
  * @return [type]           [description]
  */
 public static function getRegisterInfo($email, $username, $password)
 {
     $userkey = "u" . StringTools::getSui();
     $addtime = StringTools::getDateKu();
     // $res = DB::insert('insert into users (username, addtime,password,userkey,email) values (?, ?, ?, ?, ?)', [$username,  $addtime,$password,$userkey,$email]);
     $res = DB::table('users')->insert(['username' => $username, 'addtime' => $addtime, 'password' => $password, 'userkey' => $userkey, 'email' => $email]);
     if ($res == "1") {
         return $userkey;
     } else {
         return "error";
     }
 }
Example #2
0
 // 图片路径获取
 $picurlist = StringTools::getUrlFromContent($oneart->content);
 // 判断文章中是否有图片
 if (empty($picurlist[1])) {
     // 添加默认图
     echo '<figure><img src="images/01.jpg" ></figure>';
 } else {
     // 显示第一张图
     $onepicurl = $picurlist[1][0];
     echo ' <figure><img style="" src="' . $onepicurl . '" ></figure>';
 }
 echo "<ul>";
 echo '<p>';
 $content = $oneart->content;
 // 删除文章中的图片
 $content = StringTools::removeAllPicFromContent($content);
 // 去除html标签
 $content = strip_tags($content);
 $len = mb_strlen($content, 'utf-8');
 if ($len > 140) {
     // 截取一下字符串
     echo mb_substr($content, 0, 140, 'utf-8') . "...";
 } else {
     echo $content;
 }
 echo '</p>';
 echo "</ul>";
 echo "</div>";
 // 跳转详情页,获取参数
 $now = $oneart->articleid;
 // // 前一页的key
Example #3
0
 /**
  * 随机数列
  * @return [type] [description]
  */
 public static function getSui()
 {
     return StringTools::GetRandStr(4) . StringTools::getDate();
 }
Example #4
0
 /**
  * 添加文章的一级回复
  * @param [type] $userkey    [description]
  * @param [type] $content    [description]
  * @param [type] $articlekey [description]
  */
 public static function addFristReply($userkey, $userkeybei, $content, $articlekey)
 {
     // 一级回复的key
     $replykey = "reply" . StringTools::getSui();
     // 一级回复生成时间
     $addtime = StringTools::getDateKu();
     // 存入数据库
     $res = DB::table('reply')->insert(['userkey_pin' => $userkey, 'userkey_bei' => $userkeybei, 'reply_key' => $replykey, 'content' => $content, 'article_key' => $articlekey, 'addtime' => $addtime, 'status' => '1']);
     if ($res == "1") {
         return "success";
     } else {
         return "faild";
     }
 }