A simple php custom exception class
/**
* Custom exception handling class
*/
Class MyException extends Exception
{
// Redefine the constructor to make the message a required attribute
Php method for quickly creating arrays (application of function range)
$ Numbers = range (); // use range to directly create 1 ~ 9. an array composed of 9 numbers. it ends with "1" and "9.
Echo $ numbers [1]; //
Solve the problem of garbled characters when php intercepts UTF-8 Chinese Strings
/**
@ Php truncate UTF-8 Chinese strings with garbled characters
@ Link http://bbs.it-home.org
*/
Function
Php Chinese string intercepting php Chinese string code
/**
@ Truncate a Chinese string for GB2312 encoding
@ Http://bbs.it-home.org
*/
Function FSubstr ($ title, $ start, $ len = "", $
Php replaces the code of the parameter variable in the URL
/**
* Set a parameter in the URL to a value.
* Link: bbs.it-home.org
* Date: 2013/2/27
*/
Function url_set_value ($ url,
10 PHP programming habits
Function baz ($ y $ z ){
$ X = new Array ();
$ X [sales] = 60;
$ X [profit] = 20:
Foreach ($ x as $ key = $ value ){
Echo $ key + "" + $ value +"";
}
}
Phpdirname (_ FILE __)
Assume that the current file is stored in (d: \ www \) and the file name is test. php.Assume that the current file is stored in (d: \ www \) and the file name is test. php. The code is as follows:
Note: The
A problem encountered when uploading php files (move_uploaded_file)
When uploading a php file, you cannot use the move_uploaded_file function to move the file, but you can use copy or rename.When uploading a php file, you cannot use the
Php code for reading and processing the file content to strings
/*
* Read the file content to the string, and remove line breaks and spaces at the beginning and end of the line.
*/
Header
How to use the database configuration file in php
Description: save the database username and password in the config file. in php, use include or require as needed, and use the global keyword in the function to compile the variables for
Learning php design patterns-Singleton patterns
/**
* Php design mode: Singleton mode
* $ _ Instance must be declared as a static private variable
* Constructor and Destructor must be declared
Thoughts on the phpmvc development model
Mvc development mode MVC is a design mode that forcibly separates the input, processing, and output of an application. The MVC application is divided into three core components: Model, view, and
Learning to use php to implement a simple mvc framework
/**
Controller:
@ Link jbxue.com
*/
Class DemoController
{
Function index ()
{
Echo ('Hello World ');
}
}
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