$ Xml = simplexml_load_file ('example. xml'); // create a simplexml objectVar_dump ($ XML); // output XML?>
$ Xml = simplexml_load_file ('example. xml'); // read the XML fileForeach ($ XML-> depart as $ A) // read each depart tag in XML data
Note:Unlike other object-oriented
Programming LanguageIn PHP, the class cannot use the final modifier for an attribute variable.
If you want to declare an attribute as a constant, you can use the const keyword, without using the dollar symbol as
PHP has three major process controls: sequential control, branch control, and cyclic control.
1. Sequential Control: YesProgramPerform the preceding steps in sequence.
2. Branch Control: the program can be executed selectively. It can also be
PS:1. Catch PHP syntax errors2. Serious errors
Normal set_error_handle cannot capture these two types of errors. This is a technique for capturing these errors.
Copy codeThe Code is as follows: // test. php page
Error_reporting (0 );
• PHP page Jump 1. header () functionThe header () function is a very simple method for page Jump in PHP. The main function of the header () function is to output the HTTP header to the browser.
The header () function is defined as follows:Void
Definition and usageThe stripos () function returns the position where the string first appears in another string.
If this string is not found, false is returned.
SyntaxStripos (string, find, start)
Parameters
Description
String
The Code is as follows:
Copy codeThe Code is as follows: Class GifMerge {
Var $ ver = '1. 1 ';
Var $ dly = 50;
Var $ mod = 'C _ file ';
Var $ first = true;
Var $ use_loop = false;
Var $ transparent = false;
Var $ use_global_in = false;
Var $ x =
1. directly call the Method
Copy codeThe Code is as follows: function test ($ a, $ B)
{
Echo 'test 1: '. $ a. $ B;
}
// Call the test method. array ("asp", 'php') corresponds to the corresponding parameter.
Call_user_func_array ('test', array (
The usage of PHP empty (), isset (), and is_null () functions has been discussed a lot, and many materials may not be clear. I will repeat it again here, but I should remember it more deeply, instead of simply using program examples to speak.
The
PHP is a weak language. This is its advantage and feature, but sometimes you have to convert the type accordingly.
This is the case. In many cases, you will find that the data obtained after the conversion type is significantly different from the
The encoding of all files in the PHP conversion folder is suitable for other encoding versions released on the website. For example, if you have a GBK version, you want to have a UTF8 version or you only have the GBK source code. You want to develop
Observer mode:Defines a one-to-many dependency between objects. When the status of an object changes, all objects dependent on it are notified and automatically updated.
Observer class:1. Abstract topic role: the topic role stores all references to
Previously, I manually wrote a drop-down auto-completion function, which is simple to write. It only supports the mouse selection function and does not support keyboard selection. This function is used in many projects, so you need to do it
Factory mode: The factory class determines the type of production slice instance to be created based on the parameter.Factory class: A method class dedicated to creating other objects. That is, pay-as-you-go allocation. input parameters are selected
Without knowing it, I found that PHP has come out of Version 5.5, and I have been using PHP5.2. It makes me look like a young man from the mountains, and I am falling behind again. After I used to use closures in javascript, I suddenly became
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