How to implement a real-time search box under thinkphp3.2? ? If possible, could you please be more detailed? Thank you! !
巴扎黑2017-05-31 10:36:36
The essence is ajax
js combination
Cooperate with creating sphinx index
黄舟2017-05-31 10:36:36
Your problem description is not very clear.
Do you want to record real-time user searches? Still want to query the database when the characters in the user input box change
大家讲道理2017-05-31 10:36:36
A real-time search box I made recently: Link address
Is it similar to this? If you don't use a plug-in, the idea is very simple: listen to the user's input events, send an ajax request to PHP, PHP can simply check the database, or if the matching requirements are high, use Sphinx mentioned above, and then display the callback data to an absolute Just position it on p.
There is something worth mentioning: because this time it is to be compatible with mobile terminals, the input events of the mobile phone’s input method are different from those of the PC, and the keyup|down|press events of javascript are not well supported, so the input event needs to be bound;