Home php教程 php手册 PHP限制网页只能在微信内置浏览器中查看并显示

PHP限制网页只能在微信内置浏览器中查看并显示

Jun 13, 2016 am 09:37 AM
php built-in application develop WeChat show Check Browser fire Now of Web page limit

   微信现在算是火了,围绕微信开发的应用也越来越多了,前段时间,自己公司需要,用PHP写了一个微信应用,为了防止自己辛苦写成的PHP应用被盗用,于是通过PHP做了限制,只能在微信自带的浏览器中才能打开本应用,一开始无头绪,后经多查证,总算把这功能弄出来了,现在把具体的代码分享给大家。

  1

  2$useragent = addslashes($_SERVER['HTTP_USER_AGENT']);

  3if(strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false ){

  4echo " Sorry!非微信浏览器不能访问";

  5}else{

  6echo "可以访问";

  7}

  8?>

  注:上述方法如果伪造了HTTP_USER_AGEN方法,就能正常访问了。玩机达人若在谷歌浏览器上装个User-Agent Switcher,同样也可访问。后来想到用JS来判断是不是手机访问,但这样同样不能彻底解决问题,因为客户端浏览器若禁止了JS,该方法又失效了,所以我想,这就像在网页上屏蔽右键一样,只能难倒一些不懂的人,唉。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem of third-party interface returning 403 in Node.js environment? How to solve the problem of third-party interface returning 403 in Node.js environment? Mar 31, 2025 pm 11:27 PM

Solve the problem of third-party interface returning 403 in Node.js environment. When we use Node.js to call third-party interfaces, we sometimes encounter an error of 403 from the interface returning 403...

Where to download the genuine Ouyi? Official website download. Global Where to download the genuine Ouyi? Official website download. Global Mar 31, 2025 pm 02:09 PM

Ouyi usually refers to Ouyi OKX. The global way to download Ouyi OKX APP is as follows: 1. Android device: Download the APK file through the official website and install it. 2. iOS device: access the official website through the browser and directly download the APP.

gate.io registration tutorial gate.io registration tutorial Mar 31, 2025 pm 11:09 PM

This article provides a detailed Gate.io registration tutorial, covering every step from accessing the official website to completing registration, including filling in registration information, verifying, reading user agreements, etc. The article also emphasizes security measures after successful registration, such as setting up secondary verification and completing real-name authentication, and gives tips from beginners to help users safely start their digital asset trading journey.

okx Ouyi Exchange web version enter link click to enter okx Ouyi Exchange web version enter link click to enter Mar 31, 2025 pm 06:21 PM

1. Enter the web version of okx Euyi Exchange ☜☜☜☜☜☜ Click to save 2. Click the link of okx Euyi Exchange app ☜☜☜☜ Click to save 3. After entering the official website, the clear interface provides a login and registration portal. Users can choose to log in to an existing account or register a new account according to their own situation. Whether it is viewing real-time market conditions, conducting transactions, or managing assets, the OKX web version provides a simple and smooth operating experience, suitable for beginners and veterans. Visit OKX official website now for easy experience

ok official portal web version ok exchange official web version login portal ok official portal web version ok exchange official web version login portal Mar 31, 2025 pm 06:24 PM

This article details how to use the official web version of OK exchange to log in. Users only need to search for "OK ​​Exchange Official Web Version" in their browser, click the login button in the upper right corner after entering the official website, and enter the user name and password to log in. Registered users can easily manage assets, conduct transactions, deposit and withdraw funds, etc. The official website interface is simple and easy to use, and provides complete customer service support to ensure that users have a smooth digital asset trading experience. What are you waiting for? Visit the official website of OK Exchange now to start your digital asset journey!

The latest registration tutorial for gate.io web version The latest registration tutorial for gate.io web version Mar 31, 2025 pm 11:15 PM

This article provides a detailed Gate.io web version latest registration tutorial to help users easily get started with digital asset trading. The tutorial covers every step from accessing the official website to completing registration, and emphasizes security settings after registration. The article also briefly introduces other trading platforms such as Binance, Ouyi and Sesame Open Door. It is recommended that users choose the right platform according to their own needs and pay attention to investment risks.

gate.io latest registration tutorial for beginners gate.io latest registration tutorial for beginners Mar 31, 2025 pm 11:12 PM

This article provides newbies with detailed Gate.io registration tutorials, guiding them to gradually complete the registration process, including accessing the official website, filling in information, identity verification, etc., and emphasizes the security settings after registration. In addition, the article also mentioned other exchanges such as Binance, Ouyi and Sesame Open Door. It is recommended that novices choose the right platform according to their own needs, and remind readers that digital asset investment is risky and should invest rationally.

gate official website login address gateio web version login portal address gate official website login address gateio web version login portal address Mar 31, 2025 pm 01:15 PM

Gate.io not only provides basic buying, selling and trading functions, but also launches a variety of innovative trading models and services to meet the needs of different users. The platform also provides a wealth of trading tools and analysis functions to help users make smarter investment decisions. Users can pledge their holdings to the platform, participate in mining activities, and obtain additional benefits.

See all articles