Home >Backend Development >PHP Tutorial >Two solutions for Thinkphp unable to use -)order() sorting! _PHP Tutorial
Using ThinkPHP, I found that I cannot use ->order($order) to sort.
$order = " info.date2 desc ";
Unfortunately, the result of writing order like this becomes order by date2 limit... desc is missing.
Solution 1:
There cannot be any spaces on both sides of $order, $order = "info.date2 desc"; (correct). $order = "info.date2 desc"; (Error!)
Solution 2:
Open the file: D:WebSiteZbphp.comwwwThinkPHPExtendModelViewModel.class.php
Modify line 136 to $array = explode(' ', trim($order)); add trim Save it, as shown in the picture:
It is recommended to use the second method, but we hope that thinkphp official website can correct this small problem to prevent users from modifying the kernel code themselves. by default7#zbphp.com