/**
* Customize an exception handling class
*/
Class MyException extends Exception
{
Redefine the constructor to make the message a property that must be specified
Public function __construct ($message, $code = 0) {
$fruits = Array ("Apple", "banana");
Array_unshift ($fruits, "orange", "pear")
$fruits = Array ("Orange", "pear", "apple", "banana");
Copy CodeAdd an element at the end of an arrayThe return value of the Array_push ()
try{
You codes this maybe cause an error
}catch (Exception $err) {//This Error object needs to declare type, Exception is the system default exception handling class
echo $err->getmessage ();
}
Thrown can throw an
Class employee{
Private $sal = 3000;
protected $sal = 3000;
Public Function Getsal () {
return $this->sal;
}
}
Class Manager extends Employee {
protected $sal = 5000;
Public Function
Phpmailer Chinese use instructions, the need for friends to take it.A begins with:$AltBody--Properties derived from: Phpmailer: $AltBody file: Class.phpmailer. PHP Description: The setting of this property is an alternate display of HTML that is not
/**
*author: Black Bird Heart
* Code to implement long article pagination
Principle
* Use an array to record every page of the article (with P0, p1, p2 ... do a manual tag), and then use the PHP function to manipulate the array
Start Snipit 1
$sql = "SELECT * from"$result = mysql_query ($sql);
";
while ($row = Mysql_fetch_assoc ($result)) {
Do stuff with $row
}
Mysql_data_seek ($result, 0); The point is here.
while
Display the browser information of the Access user
Echo ' Browser: '. Determinebrowser ($Agent). '';
Show access to the user's operating system platform
Echo ' Platform: '. Determineplatform ($Agent). '';
A positive value
/**
PHP XML Operation class
link:http://bbs.it-home.org
*/
Class Requirelog
{
protected static $requirelog;
Get ready for xml,if XML is not found, create XML
static function _initializelog ()
{
if
When WebService docking with other systems, PHP was unable to recognize the time parameters under. Net. Parsing: Calling WebService code in PHP is done by hand-writing XML-formatted packets.When WebService docking with other systems, PHP was unable
PHP get the file extension of several methods, the need for friends can refer to the next.Method 1:function Get_extension ($file) {substr (STRRCHR ($file, '. '), 1);}Method 2:function Get_extension ($file) {return substr ($file, Strrpos ($file, '. ')
/**
PHP generates Word files
link:bbs.it-home.org
*/
$word = new COM ("Word.Application") or Die ("Cannot Start Word program! ");
$word->visible = 0;
$n = $word->documents->add ();
# # sub-section symbol
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