Restrict the program to only be viewed in WeChat. The following is the PHP code that restricts the page to only be accessed in WeChat's own browser. In order to prevent the webapp that I have worked so hard to make from being copied, I want to limit the program to browsing in WeChat. Although this function is implemented below, it is just a side dish with no technical content. It will be broken by someone who knows the code. The following is the PHP code that restricts the page to be accessed only in WeChat’s own browser. Example:
The above code is not perfect, and WeChat on Windows phone cannot be used. , so modify it:
You can judge by getting HTTP_USER_AGEN. However, the above code can still be accessed normally as long as HTTP_USER_AGEN is forged. Install a User-Agent Switcher on Google Chrome and you can still access it at will. So I also thought of using JS to determine whether it is accessed by mobile phone, but as long as the browser prohibits JS from running, it can still be accessed normally. But maybe this will make it difficult for some newbies. |