javascript - Should the data display on the front-end page be directly output by the background, or should an API interface be provided for the front-end to call?
阿神
阿神 2017-05-27 17:40:32
0
4
745

Does the background staff directly output the data on the page or provide an API interface to the front end, and then display it on the page similar to an ajax request?
If you use an api interface, you are afraid that the API interface link will be stolen by others. Is there any way to prevent it? ?

阿神
阿神

闭关修行中......

reply all (4)
滿天的星座

It depends on what kind of customers you have. If your background data belongs to a database class used to save customer information, you can try to use the ajax header to verify the other party's information. For details, you can learn about APIclound's documentation. When they call the interface, they use the header to verify the appid and appkey

    某草草

    The former is suitable for close integration of PHP and views, while the latter is suitable for interface service operations. The specific choice depends on the actual situation of your project. If you use an interface, you can set sign signature verification and token login verification for your interface

      淡淡烟草味

      You can verify permissions on both interfaces and pages. For example, you need to log in to view it, and you can only view it if you have a corresponding level. These can be placed in the session.

        黄舟

        If you directly output the page, it will also be crawled away. It is better to find ways to strengthen user verification and check before entering sensitive pages. The backend needs to have an anti-crawling mechanism. Even legitimate users who obtain a large amount of data in a short period of time must be automatically blocked and Adamin notified.

          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!