ThinkPHP obtains the functions of the previous article in ThinkPHP. you can refer to the method below and apply them to other websites with slight modifications. the method is the same! // Obtain the functions of the previous article in functionPrevNext ($ id, $ name = '', $ where = array (), $ fields = 'id, ti ThinkPHP
ThinkPHP gets the function from the previous article. you can refer to the method and apply it to other websites with slight modifications. the method is the same!
// Obtain the function PrevNext ($ id, $ name = '', $ where = array (), $ fields = 'id, TITLE') of the previous article ') {$ array = array (); $ model = M ($ name); $ map = array (); $ map = $ where; $ map ['id'] = array ('Lt ', $ id); $ prevL = $ model-> field ($ fields)-> where ($ map) -> order ('Id desc ')-> find (); // if (! $ PrevL) {$ prevL ['id'] = ''; $ prevL ['title'] = 'unavailable temporarily ';} $ map ['id'] = array ('GT ', $ id); $ nextL = $ model-> field ($ fields)-> where ($ map) -> order ('Id asc ')-> find (); // The next if (! $ NextL) {$ nextL ['id'] = ''; $ nextL ['title'] = 'temporarily absent ';} $ array ['prev'] = $ prevL; $ array ['Next'] = $ nextL; return $ array ;}?