Home > Backend Development > PHP Tutorial > PHP simple method to obtain and determine the source of submission, php obtains the source of submission_PHP tutorial

PHP simple method to obtain and determine the source of submission, php obtains the source of submission_PHP tutorial

WBOY
Release: 2016-07-12 08:53:46
Original
821 people have browsed it

How to simply obtain and determine the source of submission in PHP, how to obtain the source of submission in php

The example in this article describes how to simply obtain and determine the source of submission in PHP. Share it with everyone for your reference, the details are as follows:

echo $_SERVER['HTTP_REFERER'];

Copy after login

This gets the url of the previous page

For example, what you get is:

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

Copy after login

Submissions from other pages will not be accepted
The code is as follows:

if(strpos($url,'http://www.weisuyun.com')){
echo '来源正确';
}else{
echo '来源不明';
}

Copy after login

The strpos method returns the position where the specified string appears for the first time, otherwise it returns false, and the subscript starts from 0

Supplement:

stripos() - Finds the first occurrence of a string within another string (case insensitive)
strripos() - Finds the last occurrence of a string within another string (case insensitive)
strrpos() - Finds the last occurrence of a string within another string (case sensitive)

Readers who are interested in more PHP-related content can check out the special topics on this site: "Summary of PHP ajax skills and applications", "Summary of PHP operations and operator usage", "Summary of PHP network programming skills", "PHP basic syntax" "Introductory Tutorial", "Summary of PHP Office Document Skills (Including Word, Excel, Access, PPT)", "Summary of PHP Date and Time Usage", "Introduction to PHP Object-Oriented Programming", "php String Usage" Summary", "Introduction Tutorial on PHP MySQL Database Operation" and "Summary of Common PHP Database Operation Skills"

I hope this article will be helpful to everyone in PHP programming.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1122887.htmlTechArticleHow to simply obtain and determine the source of submission in PHP, how to obtain the source of submission in php. This article describes how to simply obtain and determine the source of submission in PHP. Source method. Share it with everyone for your reference, the details are as follows...
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template