利用网址传送资料_PHP
懂得HTML(超文本标识语言)的读者都应该知道在“<FORM>”的标签内可使用添加“GET”和“POST”参数的方式将资料送回HTTP服务器,其实,在PHP语言中我们同样可以使用“GET”及“POST”参数。除此之外,在网址上亦可以加上“GET”的资料,例如我们以下面的URL为例:
http://www.yourserver.com/download/down.php?id=1
http://www.yourserver.com/news/show.php?page=1
这些URL通常在网站的搜索引擎中会使用得最多,你看到的URL中都带了各种参数,目的是为了将资料传回http服务器以便找到相关信息。如果你觉得这个方式不好,笔者有另外一种方法可将传送的资料加在 URL 上,例如下面的网址:http://www.yourserver.com/vote/php/show.php/200107/2138/。
其对应的PHP源代码如下:
<﹖
$url_variable = split″/″ $PATH_INFO
//取得网址后的资料
array_splice$url_variable 01
//刪除第一个空白的记录
$category_id = $url_variable0
$product_id = $url_variable1
﹖>
利用这种方法,你同样可以取得资料,不过要留意的是在URL上的资料次序是与“Array”(数组)内的次序一样,所以如果输出URL的资料有错,服务器在读入资料时就会出现错误,这需要我们加以注意。
另外如要输出中文字体到URL的话,你需要先用“rawurlencode”这个函数将中文字体转为RFC1738编码,方能达到你想要的显示效果。
摘自:赛迪网

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

If you want to check some relevant information in Steam or share some website links with friends, how do you do it? Can I enter a URL into steam? Of course it is possible. Below I will teach you how to open a URL in Steam. Specific methods: 1. First, we open steam. 2. Click the Settings option. 3. Then switch to the interface tab. 4. Check Show address bar. 5. Then enter the URL in the address bar to use the browser.

PHP function introduction—get_headers(): Overview of obtaining the response header information of the URL: In PHP development, we often need to obtain the response header information of the web page or remote resource. The PHP function get_headers() can easily obtain the response header information of the target URL and return it in the form of an array. This article will introduce the usage of get_headers() function and provide some related code examples. Usage of get_headers() function: get_header

The reason for the error is NameResolutionError(self.host,self,e)frome, which is an exception type in the urllib3 library. The reason for this error is that DNS resolution failed, that is, the host name or IP address attempted to be resolved cannot be found. This may be caused by the entered URL address being incorrect or the DNS server being temporarily unavailable. How to solve this error There may be several ways to solve this error: Check whether the entered URL address is correct and make sure it is accessible Make sure the DNS server is available, you can try using the "ping" command on the command line to test whether the DNS server is available Try accessing the website using the IP address instead of the hostname if behind a proxy

PHP URL detection refers to using the PHP programming language to verify whether the input string conforms to the format of the URL. Methods to detect URLs: 1. Use regular expressions for URL verification. You can use the "preg_match" function to perform regular matching, if the URL matches the pattern; 2. Use built-in functions for URL verification, use the "filter_var" function and "FILTER_VALIDATE_URL" ” filter to verify.

Differences: 1. Different definitions, url is a uniform resource locator, and html is a hypertext markup language; 2. There can be many urls in an html, but only one html page can exist in a url; 3. html refers to is a web page, and url refers to the website address.

Nowadays, many Windows users who love games have entered the Steam client and can search, download and play any good games. However, many users' profiles may have the exact same name, making it difficult to find a profile or even link a Steam profile to other third-party accounts or join Steam forums to share content. The profile is assigned a unique 17-digit id, which remains the same and cannot be changed by the user at any time, whereas the username or custom URL can. Regardless, some users don't know their Steamid, and it's important to know this. If you don't know how to find your account's Steamid, don't panic. In this article

How to use GitLab for project document management 1. Background introduction In the software development process, project documents are very important information. They can not only help the development team understand the needs and design of the project, but also provide reference to the testing team and customers. In order to facilitate version control and team collaboration of project documents, we can use GitLab for project document management. GitLab is a version control system based on Git. In addition to supporting code management, it can also manage project documents. 2. GitLab environment setup First, I

Use url to encode and decode the class java.net.URLDecoder.decode(url, decoding format) decoder.decoding method for encoding and decoding. Convert into an ordinary string, URLEncoder.decode(url, encoding format) turns the ordinary string into a string in the specified format packagecom.zixue.springbootmybatis.test;importjava.io.UnsupportedEncodingException;importjava.net.URLDecoder;importjava.net. URLEncoder
