search

Home  >  Q&A  >  body text

php implements real-time search

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

黄舟黄舟2766 days ago837

reply all(4)I'll reply

  • 巴扎黑

    巴扎黑2017-05-31 10:36:36

    1. The essence is ajax

    2. js combination

    3. Cooperate with creating sphinx index

    reply
    0
  • 黄舟

    黄舟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

    reply
    0
  • 高洛峰

    高洛峰2017-05-31 10:36:36

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

    reply
    0
  • 大家讲道理

    大家讲道理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;

    reply
    0
  • Cancelreply