Usage of get, post, request, cookies, and session variables in the smarty Template
{$ Smarty. now | date_format: "% Y-% m-% d % H: % M: % S "}
2. {$ smarty. const} can directly access PHP constants. for example:
Tutorial on SingletonPattern
Class DatabaseConnection {
Private static $ db;
Private static $ _ handle = null;
Public static function get (){
If (self: $ db = null ){
Echo _ LINE __;
How to export xls files using php
Header ("content-type: application/vnd. ms-excel ");
Header ("content-disposition: attachment; filename=example.xls ");
// Note that the following head must be consistent
Small example of php string encoding conversion
Function phpcharset ($ data, $ ){
If (is_array ($ data )){
Foreach ($ data as $ key => $ val ){
$ Data [$ key] = phpcharset ($ val, $ );
Php destructor and garbage collection mechanism
Class person {
Public function _ destruct (){
Echo"The Destructor is executed here ";
Echo"It is generally used to place, close the database, close the
Use details of the curlopt_postfields parameter in phpcurl
When curl is used to send some data to the server without looking at the details, the following results may be obtained. this is not the ideal result:
Php intercepts UTF-8 or gbk encoded Chinese and English strings
// String truncation
$ A = "s @ ";
Var_dump (strlen_weibo ($ a, 'utf-8 '));
The result output is 8, where the letter s is counted
Php Chinese character transcoding GBK-& amp; gt; Unicode (UTF8) encoding conversion
// Php Chinese character transcoding GBK-> Unicode (UTF8)
Class qswhGBK {
Var $ qswhData;
Function qswhGBK ($
Php5 destructor usage example
/*
* To change the template for this generated file go
* Window-preferences-phpeclipse-php-code templates
*/
Class student {
// Attributes
Private $ no;
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