PHP simple fetch and judge the method of the source of the submission PHP calls the parent class method PHP calls the class method PHP functions and methods of the area

Source: Internet
Author: User
Tags php database
This paper presents a simple method for PHP to obtain and judge the source of the submission. Share to everyone for your reference, as follows:

echo $_server[' Http_referer '];

This gets the URL of the previous page

For example, get:

$url = http://www.weisuyun.com/nihao.html

Other pages submitted to not accept
The code is as follows:

if (Strpos ($url, ' http://www.weisuyun.com ')) {echo ' source is correct ';} Else{echo ' source unknown ';}

The Strpos method returns the position of the specified string where the specified string first appears, no returns false, and the subscript starts at 0

Add:

Stripos () -finds the position of the first occurrence of a string in another string (case insensitive)
Strripos () -finds the last occurrence of a string in another string (case insensitive)
Strrpos () -finds the last occurrence of a string in another string (case-sensitive)

Read more about PHP related content readers can view the topic: "Php+ajax Tips and Applications Summary", "PHP operation and operator Usage Summary", "PHP Network Programming Skills Summary", "PHP Basic Grammar Primer Tutorial", "PHP operation Office Document Tips Summary ( including word,excel,access,ppt), PHP date and Time usage summary, PHP Primer for object-oriented programming, PHP string usage Summary, PHP+MYSQL database Operations Starter Tutorial, and A summary of common PHP database operation techniques

I hope this article is helpful to you in PHP programming.

The above describes the PHP simple access and determine the source of the method of submission, including PHP, the content of the method, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.