1. received url content publicfunctionnewstype (Request $ request) {$ url $ request-& gt; url (); $ isfirstinput (isfirst); $ uidinput (token);} 2. pointer instance. & amp;
// 1. receive the content in the url
public function newstype(Request $request) { $url = $request->url(); $isfirst = input('isfirst'); $uid = input('token'); }
A. replace nowtime in $ news with $ 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) {// news comment $ 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 new '); foreach ($ nowtime as $ n) {$ mm ['nowtime'] = date ("Y-m-d H: I: s ", $ n ['nowtime']);}
B. append $ vvv ['ncommtent] to $ new.
$ News = Db: query ("select nid, ntitle, nauthor, reviewnum, nowtime, iscollect from news where nsid = '{$ ntid}' limit 6 "); foreach ($ news as & $ mm2) {// news comment $ ncommtent = Db :: query ("select ncommtent from newreview where nid = {$ mm2 ['nid']}"); foreach ($ ncommtent as $ vvv) {$ mm2 ['ncommtent'] = "{$ vvv ['ncommtent']}";}
// 3. output json
$ Data = array ('code' => 0, 'MSG '=> array ('news' => $ news, 'newsimg' => $ newsimg, 'Comments '=> $ comments); return json_encode ($ data, 256); // Convert json with no garbled characters
The above is a detailed description of the pointer instance. For more information, see other related articles in the first PHP community!