Common PDO Class Libraries

1. Db. class. php // Connect to the databaseClass Db {Static public function getDB (){Try {$ Pdo = new PDO (DB_DSN, DB_USER, DB_PWD );$ Pdo-> setAttribute (PDO: ATTR_PERSISTENT, true); // set the database connection to persistent connection.$ Pdo->

Summary of several character functions in php

The following is a summary of several character functions in PHP: 1) ucfirstChange the first letter to uppercase, for example$ String = "this is my web development blog "; Echo ucfirst ($ string ); // Output: This is my web development blog 2)

Implementation of PHP scheduled task execution

Functions used: ignore_user_abort (), set_time_limit (0), sleep ($ interval) This Code only needs to close the browser once it runs. Ignore_user_abort (); // close the browser and run the PHP script. Set_time_limit (0); // use set_time_limit (0) to

PHP intercepts Chinese string functions ~ Including GB2312 and UT-8

/*Chinese character truncation functions supported by Utf-8 and gb2312Cut_str (string, truncation length, start length, encoding );The default encoding format is UTF-8.The default start length is 0.*/ Function cut_str ($ string, $ sublen, $ start = 0

Php5.3.10 automated deployment script first version

After completing the deployment in the first phase of php5.3.10, I made a summary and wrote the php deployment into shell script automatically, which will facilitate the subsequent expansion and practice the shell script I learned

Php voting (Investigation)

/*** Voting Investigation****/Include "isLogin. php ";Include "../conn/config. inc. php ";/* Initialize the action */If (emptyempty ($ _ REQUEST ['action']) {$ _ REQUEST ['action'] = 'LIST ';} Else {$ _ REQUEST ['action'] = trim ($ _ REQUEST

A comprehensive example of jQuery/Ajax/PHP/Json

JQuery is an excellent Javascript framework that provides excellent packaging of js and many convenient functions. JQuery's ajax packaging is also excellent. JQuery can transmit data using the json File Transfer Protocol (similar to xml, and has a

Php Verification Code

/*** Verification Code* 2011/8/21* Kcj**/Include "isLogin. php ";// Generate a 4-digit Verification Code randomly$ Num = '';For ($ I = 0; $ I $ Num. = dechex (rand (); // The dechex function is a decimal transfer binary.}Session_start (); // enable

How php downloads various files

If we only use to download or js window. location = 'file path/upload ','. conf ','. bin' file. Of course, the document.execcommand('saveas', 'mycodes.txt ') (the second parameter is the file name to be saved) of JS can also be downloaded, but its

Php remembers the user name and password implementation code (cookie)

Remember. php remember the user name and password User name: "Name =" name "> password: "> remember the username and password  Check_remember.php$ Name = $ _ POST ['name'];$ Password = $ _ POST ['Password'];$ Remember = $ _ POST

Php --- PHP uses the GD library for screenshots

PHP uses the GD library for screenshot capturePHP5.2.2 and later versions of the GD library implement two screenshot functions: imagegrabscreen and imagegrabwindowIt is used to intercept the entire screen and intercept a window (same as ALT +

PHP class automatic loading mechanism

During PHP development, if you want to introduce a class from the outside, the include and require methods are usually used to include the file defining this class. This is not a big problem during small-scale development. However, in large

How to execute php code in the smarty Template

The main purpose of the Smarty template is to separate the logical layer and the presentation layer. Therefore, the template should not contain the logical part, and the logical layer should not contain HTML. This "very" approach to inserting

PHP calls Google Translate

/** PHP calls Google Translate* Author: cc* Date: 2012/5/4*/Function translate ($ text, $ language = 'zh-cn | en '){If (emptyempty ($ text) return false;@ Set_time_limit (0 );$ Html = "";$ Ch = curl_init ("http://google.com/translate_t? Langpair = ".

PHP half way home (3)

PrefaceReflecting on some of the recently written things, I feel a little bit For coder that has learned java or C ++, The syntax is meaningless, such as OOP and exceptions. Instead of simply looking at the instance code, If you don't understand it,

Check whether the PHP file contains bom in the PHP File

/* Check and clear BOM */If (isset ($ _ GET ['dir']) {$ Basedir = $ _ GET ['dir'];} Else {$ Basedir = '.';}$ Auto = 1;Checkdir ($ basedir );Function checkdir ($ basedir ){If ($ dh = opendir ($ basedir )){While ($ file = readdir ($ dh ))! = False

Customize session storage in PHP

apc

Description In PHP, you can define session_set_save_handler to store Server session data on different media, such as files, apc or memcache caches, or databases. You can calculate the number of online users, or kick the login status of specific

Php-Arrays function-chunk-splits an array into multiple Arrays

Chunk () function[Function]This function splits an array into multiple arrays,The number of units in each array is determined by the size.The number of units in the last array may be smaller.The obtained array is a unit in a multi-dimensional array,

Paging ideas and use in ZF

Paging ideas:You only need to get two variables to get half done:1. Number of records to be displayed per page $ pageSize2. Total data volume in the table $ rowCountWith the above two variables, we can get a total of several pages. $ pageCountThen,

PHP design pattern series-builder Pattern

What is builder mode?The builder mode is mainly used to eliminate complicated creation processes of other objects.Design scenarioThere is a user's UserInfo class. To create this class, you must create the user's name, age, money, and other

Total Pages: 12780 1 .... 10129 10130 10131 10132 10133 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.