php implements real-time search
黄舟
黄舟 2017-05-31 10:34:36
0
4
777

How to implement a real-time search box under thinkphp3.2? ? If possible, could you please be more detailed? Thank you! !

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(4)
巴扎黑
  1. The essence is ajax

  2. js combination

  3. Cooperate with creating sphinx index

黄舟

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

小葫芦

Use setTimeOut(), and then there is ajax inside, it should be like this

大家讲道理

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;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!