$ _ COOKIE is a very useful thing in php, but sometimes we encounter different subdomains under the same domain name, so there will be a problem that only one cookie can be retained, the following is a small series for you to introduce.
PHP's hyper-global variable $ _ COOKIE brings a lot of convenience and may also cause confusion in some cases. For example, if a cookie with the same name exists in the root domain and subdomain, $ _ can only save one COOKIE. Which one should it be?
We recommend
/123 '! = $ Http_protocol)$ Http_protocol = 'HTTP/1.0 ';// Response 301 status codeHeader ("$ http_protocol 301 Moved Permanently ");// Specify the redirected URL$ New_url = 'HTTP: // www. bKjia. c0m /';Header ("Location: $ new_url ");?>
PHP 302 redirection:
The Code is as follows:
Copy code
Header ("Location: http: // www.Hzhui. Com /");Exit ();
The PHP 404 error is also included with the following code:
In many applications, I often want to beautify the select statement. Now I provide you with a free jquery plug-in code for simulating the drop-down box. The following is the sample code.
In many applications, I often want to beautify the select statement. Now I provide you with a free jquery plug-in code for simulating the drop-down box. The following is the sample code.
Selected> life information Value = 3> News Value = 5> recruitment information Onblur = "if (this. value ='') {this. valu
value, execute the statement following the corresponding data, and when the keyword break is encountered, the program jumps out of the switch structure. If the value of a is not found, execute the statement under the keyword default.
Switch case statement:
The Code is as follows:
Copy code
Var year = 8;Var army = "", msg = "";Switch (parseInt (year )){Case 0:Army = "civilian ";Break;Case 1:Army = "private ";Break;Case 2:Army = "Attach ";Break;Case 3:Case 4:Case 5:Army =
(the following variables must be configured when UC_DBLINK is not set during mysql connection)Define ('UC _ dbhost', 'localhost'); // UCenter database hostDefine ('UC _ dbuser', 'root'); // user name of the UCenter databaseDefine ('UC _ DBPW ', '000000'); // UCenter database passwordDefine ('UC _ dbname', 'ucenter'); // ucenter database nameDefine ('UC _ dbcharset', 'utf8'); // UCenter database character setDefine ('UC _ dbtablepre', 'ucenter. UC _ '); // ucenter database table prefixDefine ('U
This article adds several url encoding parsing functions in php, such as parse_url, rawurldecode, rawurlencode, urldecode, and urlencode.
This article has added several url encoding parsing functions, such as parse_url, rawurldecode, rawurlencode, urldecode, and urlencode.The following describes the introduction and examples.Parse_url ($ str url );Convert a url into an array*/Print_r (parse_url ("www. bKjia. c0m"); // parse the url and output the retu
This article introduces asp.net's implementation of 301 redirection without www domain name to domain name with www. It also includes various implementation methods, including php, asp, and apache.
Some friends may use the benzene method, and add the Response. RedirectPermanent method to each Controller. A simple practice is to add the following code to Global. axax. cs:
The Code is as follows:
Copy code
Protected void Application_BeginRequest (object sender, EventArgs e)
Next we will talk about the mysql stored procedure case statement syntax and instance tutorial. on the home page, let's take a look at the simple description of the case statement, and then explain the specific usage of the case with examples.
Next we will talk aboutMysql tutorial stored procedure case statement syntax and example tutorialOh, let's take a look at the simple description of the case statement on the homepage, and then use the example description.Case.
Case statement.
The case stat
_ secret'] = '';
Change
The code is as follows:
$ Cfg ['blowfish _ secret'] = 'bkjia. c0m ';
(Note: 'bkjia. c0m' is a random character)
2. in The phpMyAdmin Directory, open config. sample. inc. php, line 18.
The code is as follows:
$ Cfg ['blowfish _ secret'] = '';
Cheng
The code is as follows:
$ Cfg ['blowfi
Phpiconv () encoding conversion error: Detectedanillegalcharacter. Number prototype: stringiconv (string $ in_charset, string $ out_charset, string $ str), especially the second parameter description: theoutputcharset. use iconv () to convert an output character encoding non-count prototype: string iconv (string $ in_charset, string $ out_charset, string $ str)
In particular, the second parameter description:
The output charset.
When iconv () is used to convert a character that is not supported
Next we will introduce the usage of var_export and var_dump. If you need it, please refer to it.
Var_export must return valid php code, that is, the Code returned by var_export can be directly assigned a variable as a php code. And this variable will get the same type value as var_export.
• However, when the variable type is resource, it cannot be simply copied. Therefore, when the var_export variable is resource type, var_export returns NULL.
Instance
The Code is as follows:
Copy c
);
Urldecode, urlencodeThe following describes the introduction and examples.Parse_url ($ str url );Convert a url into an array
The Code is as follows:
Copy code
*/Print_r (parse_url ("www. bKjia. c0m"); // parse the url and output the returned array/*
Returns a string in special url format to a normal string.
Syntax: string rawurldecode (string str );
Return Value: String
Function Type: EncodingDescription
This
404 http://www.xxx.com/404.htm
The former returns a 404 status code,
The latter returns a 200 status code. If the content of a 404 page is smaller than 404 B, IE considers the 404 page unfriendly and will not return the error page in IE.
Add a backslash at the end of the URL in htaccess
Add the following code to the htaccess file:
The Code is as follows:
Copy code
IfModule mod_rewrite.cRewriteCond % {REQUEST_URI}/+ [^.] + $RewriteRule ^ (. + [^/]) $ % {REQUEST_URI
path
1, $ _ SERVER ["QUERY_STRING"]Description: query string2, $ _ SERVER ["REQUEST_URI"]Description: The URI required to access this page
3, $ _ SERVER ["SCRIPT_NAME"]Description: path containing the current script
4, $ _ SERVER ["PHP_SELF"]Description: File Name of the script being executed
Instance:1, http://www.bKjia. c0m/(open the home page directly)Result:$ _ SERVER ["QUERY_STRING"] = ""$ _ SERVER ["REQUEST_URI"] = "/"$ _ SERVER ["SCRIPT_NAME"]
The short website is now used more and more jump websites will be generated, like the original Weibo also has this function, I would like to recommend you a PHP URL shortening code
Each URL is replaced by 6 characters, and (32 ^ 6) can have up to 1,073,741,824 short URLs. Of course, you can also record more detailed information, such as access records and creation time. If it is not enough, you can delete it for a long time.
The Code is as follows:
Copy code
Function comp
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.