Core code:
connect ("127.0.0.1", 11211)) {
die (' Connection failed ');
}
if ($memcache->set (' Key1 ', "Xian", memcache_compressed,60)) {
echo ' sucess! ';
} A stored value in which the Xian string can also be an array, an object, but
1. Insert a record
$data = Array (
' title ' => ' My title ',
' name ' => ' I name ',
' date ' => ' My Date '
);
$this->db->insert (' mytable ', $data);
Produces:insert into MyTable (title, name, date) VALUES (' I title ', ' My Name ', ' My
Today, when dealing with a specific character at both ends of the string, you encounter the following problem, first look at the example
$str = ' Akmumu/writedb.json ';What I'm going to do is delete the starting Akmumu, and then delete the. JSON
This article is a simple example of the implementation of the PHP multitasking program, the specific code is as follows:
_pref = 0;
The public static function getinstance ($file) {if (null = self::$_instance) {self::$_instance = new self;
In this paper, an example of PHP to establish a multi-level directory implementation method, code concise and practical, powerful, for PHP programmers have a certain reference value. Details of the example are as follows:
/**
* Based on path
By order of magnitude, the common time complexity is: Constant order O (1), Logarithmic order O (log2n), linear order O (n), linear logarithmic order O (nlog2n), square O (n2), Cubic O (N3)
Copy Code code as follows:
Two-point search O
Use session and cookies to save user login information at the same time
1. Database Connection Configuration page: connectvars.php
Copy Code code as follows:
Location of the database
Define (' Db_host ', ' 127.0.0.1 ');
User
You can use PHP or Nginx to add x-frame-options headers to control Frame permissionsX-frame-options has three optional values:
Deny: Browser rejects current page loading any frame pageThe address of the Sameorigin:frame page can only be a page
Today, when I wrote PHP, I found that $_post["arr" could not get an array of parameter arr.
For example, the following form needs to be submitted:
Copy Code code as follows:
You can only get the value of the last selected check
1. You can use the Func_get_args () and Func_num_args () functions to implement the overload of the function!!
PHP Code:
Copy Code code as follows:
function rewrite () {
$args = Func_get_args ();
if (Func_num_args () = = 1) {
Func1 (
Let me first introduce you to the function used:
Copy Code code as follows:
Mb_strwidth ($STR, $encoding) returns the width of the string
$str the string to be evaluated
$encoding the encoding to use, such as UTF8, GBK
Copy Code code as follows:
Iconv (' GBK ', ' utf-8//ignore ', ' cloud-dwelling community '); Converts a string from GBK encoding to UTF-8 encoding
However, the iconv can only solve the situation in which the encoding is known, and
I have encountered this problem, online to find this solution, the collection ofPHP Friends must have encountered a problem: the header function to change the HTTP protocol header, there will be a similar format in the following warning:
Copy
In PHP, if you use a session to determine whether a user is logged in or out, you can do so:
Session_Start ();Session_destroy ();
The session indicates that it has ended. Next sentence should write JS, so that the page jump.
If it is a frames
Problem foundWhile tracking the Yratings_get_targets,Error_log (Var_export (Yblog_mspconfiginit ("ratings"), true); always print out yblog_mspconfiginit ("ratings") return is null
Cause I thought it was impossible to build a connection with DB and
Sometimes we encounter the problem of special characters in the filter string, this article provides a way to handle special strings, there may be omissions, if the reader found that you can leave a message to tell me, thank you.
Copy Code
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