gongzhonghao.png
扫码关注我们
最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

对于指针的实例详解

来源:http://erdangjiade.com/topic/3174.html 你好,世界。 2017-09-25 22:42浏览(24)

//1.接收url里面的内容

 public function newstype(Request $request)
    {

        $url = $request->url();
        $isfirst = input('isfirst');
        $uid = input('token');
   }

 

a. 要有    把$news里面的nowtime用$mm替换....

$news = Db::query('select news.nid,news.ntitle,news.nauthor,news.reviewnum,news.nowtime,news.iscollect,newreview.ncommtent from news,newreview WHERE news.nid=newreview.nid');
foreach($news as &$mm){
    //新闻评论
    $ncommtent = Db::query("select ncommtent from  newreview  where nid = {$mm['nid']}");
    foreach($ncommtent as $vvv){
        $mm['ncommtent'] = "{$vvv['ncommtent']}";

    }
    $nowtime = Db::query('select nowtime from  news ');
    foreach($nowtime as $n){
        $mm['nowtime'] = date("Y-m-d H:i:s", $n['nowtime']);

    }

}

  

b.把$vvv['ncommtent]追加到$new 里面

   $news = Db::query("select nid,ntitle,nauthor,reviewnum ,nowtime,iscollect from  news  where nsid = '{$ntid}' limit 6,6");
                    foreach($news as &$mm2){
                        //新闻评论
                        $ncommtent = Db::query("select ncommtent from  newreview  where nid = {$mm2['nid']}");
                        foreach($ncommtent as $vvv){
                            $mm2['ncommtent'] = "{$vvv['ncommtent']}";

                        }

  //3.输出json

 $data = array(

                'code' => 0,
                'msg' =>
                    array(
                        'news' => $news,
                        'newsimg' => $newsimg,
                        'comments' => $comments
                    )
            );
            return json_encode($data,256);  //转json,并且不出现乱码

  

以上就是关于指针的实例详解的详细内容,更多请关注二当家的素材网其它相关文章!

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2