The example in this article describes how to cache php variables in file form. Share to everyone for your reference. The implementation method is as follows:
[PHP] view plaincopy
/*
$cache _set = Array (
Cache path, last add "/"
'
1.1 Factory mode, factory method or class generate object, not in code direct new
Class factory{ static function Getdatabase () { return new Mysql ($host, $user, $pass); } } #使用 factory::getdatabase ();
1
Excuse me
$test = Array ();
Function ABC ($port, $index = 0) {
if (!isset ($GLOBALS [' Test '] [$index]))
$GLOBALS [' Test '] [$index] = array ();
$GLOBALS [' Test '] [$index] [] = $port;
}
?>
I would like to ask the above code and
Similar to this:
Class MyClass { private $index; Public function __construct ($index) { if ($index = = = 0) { //Destroy Object } $this->index = $index; } Public Function GetIndex () { return $this->index; }} $t = new
Under the same website, use Setcookie ("Userlogin", "TEST", Time () +60*60*24); The statement sets the COOKIE value, which can be used with echo $_cookie["Userlogin" on this page; Read, but go to other pages of the same site with Echo
PHP supports a total of 8 primitive types, including 4 winning types, namely: Boolean (Boolean), Integer (Shape), float/double (floating point), and String (string), two composite types: Array (array) and object (objects) ; Two special types, namely:
foreach ($conn->query ($SHOWSQL) as $row)
$res = $conn->query ($SHOWSQL);
while ($row = $res->fetch ()
These two query efficiency that is relatively fast.
Reply to discussion (solution)
The same speed, but the latter may use less
A cookie written by PHP Setcookie a day when the customer reads a webpage
For example: Setcookie ("name", "Value", Time () +864000)
How do I know how long this cookie is going to expire? To be re-written if the expiration time is less than 1 days.
The simplest and most accurate class of PHP Chinese to pinyin the GitHub project address: Https://github.com/jifei/Pinyin
Support to get pinyin and pinyin abbreviation is the first letter
Support Utf-8, GBK and other encodings
Can accurately
. Represents the addition of strings
In Java.
$ as a prefix for variables, in addition to the variable name definition rules with Java
Parameter passing and method return simultaneous references need to be prefixed &
Example code:function f (&
For security reasons, the data to be passed cannot be uploaded to the server, which leads to the unavailability of the data link parameter.
Cookies are uploaded to the server, and cookies seem to be very insecure.
Reply to discussion
The system environment is Windows + IIS
PHP environment is a WAMP suite package
, it is normal to run locally, and the direct cmd command on the server is normal.
But it is through the PHP program to call this command to return the failure, may be a
Do not know is not the configuration of the problem, I will be all the MySQL after the reload or so, with the official MySQL Workbench no problem.
The direct execution of Mysqli_init () in PHP is also reported as an error in the property access was
The JSON data sent to the Android interface is a little confusing, is there any great God has encountered such a situation, how to solve?
Reply to discussion (solution)
Bad judgment, not BOM bar, send code to see
is clearly BOM header, and
Baidu looked for some, but all use not good, see some comments said now revised, can not achieve that
Ask now PHP Development initiative to the public attention to send the text message to how to achieve
Reply to discussion (solution)
Mass
Look at http://123langzheng.blog.163.com/blog/static/1362078062011125111528576/.
The following examples illustrate their usage, assuming that the Integratedtemplate class and the Integratedtemplateextension class are in C:\php4\pear\HTML\ITX.php
In PHP, I often write a class, the class writes a common method, and then let the subclass to inherit to get the corresponding function. Let's say there's a parent class roughly:
1
Then, make a subclass to inherit him:
1
Now that
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