Switch statements in PHP are used to perform different actions based on multiple different conditions.
Switch Statement
If you want to selectively execute one of several blocks of code, use a Switch statement.
use a Switch statement to
I'm actually calling a Zend database access method, using the Fetchall method, but because the record is not in the database, the returned object is null, so I'm going to determine if the object is null:
Copy Code code as follows:
Naming conventionsThe θ class files are suffix with. class.php, named with the Hump method, and capitalized, for example, Pay.class.php;
θ class Name and directory _ filename are consistent. For example: The Directory of class name Zend_autoloader
The results of the PHP tutorial function "Str_split" to split, will appear garbled, because the length of Chinese characters and English characters are not the same length. But we can create a new function to convert characters to ASCII values, and
Variable relatedInternal implementation of PHP variablesthe system type of the programming language is divided into strong type and weak type two kinds:
A strongly typed language is one in which a variable is declared as a variable of a type,
PHP is a single inherited language, and before PHP 5.4 traits, PHP classes cannot inherit properties or methods from two base classes at the same time. PHP's traits is similar to the Go language combination, by declaring the trait name to be
The example in this article describes how PHP implements caching based on file storage. Share to everyone for your reference. as follows:
In some database data record is big, but the server is limited, may a MySQL query will be good hundreds of
PHP is a dynamic interactive site to create a server-side scripting language, advantages: PHP scripting language widely used, open source free, the most important thing is easy to get started, easy to master.
PHP can generate dynamic page content
Overviewto access the contents of a variable, you can use its name directly. If the variable is an array, you can use a combination of variable names and keywords or indexes to access its contents.Like other variables, using operator = can change
PHP as an open source language, development has been a lot of mature domestic and foreign open source system, enough to meet the individual and enterprise users to establish their own web site, the following is mainly introduced PHP station process
Using the latest PHP grammar files and automatic completion of the file (PHP code completion function shutdown).
Integrates only Zendstudio ZendCodeAnalyzer1.2.2 as PHP Code Analyzer. Does not rely on the Php+mysql server to run the
One, Json_encode ()
This function is used primarily to convert arrays and objects into JSON format. Let's look at an example of an array conversion:
$arr = Array (' A ' =>1, ' B ' =>2, ' C ' =>3, ' d ' =>4, ' e ' =>5);
Echo Json_encode
This article introduces the code of the dynamic implementation of the double Pull-down menu, for example: In the main menu has "Focus News", "Life Style", "Mood Story" three options, through the "Focus News" choice, submenu automatically generated
Here we will analyze how to open and use the Smarty cache, how to clear the Smarty cache and Smarty Global cache, partial caching, local caching three kinds of caching mechanism.
First, open and use the Smarty cache
To turn on the Smarty cache,
The following describes the features of the Smarty template engine:
1. Speed: A program written with Smarty can achieve maximum speed, which is relative to other template engine technology.
2. Compile: The program written by Smarty to compile into
Phpbean's core files are very few, and this is very relevant to the design idea of Phpbean (emphasis on performance and division of development). The core of Phpbean is simply to implement the basic MVC framework without providing any extra code
When the page is loaded, using AJAX asynchronous back to the table to request data, load a class of goods, when the choice of a class of goods loaded two-class goods, select two-class goods loaded three-class goods.
Realize:1, when the data load
Determine whether it is mobile phone or computer isMobile () or mobile phone ismobile
1. Write the method for judging the mobile phone in the PublicController.
2. inherit this method from the php controller IndexController. class. php:
3. Call and
The code is as follows:Copy code /*** Tool for the first letter of Chinese character and Pinyin* Note: The English string does not change and returns (including numbers) eg. abc123 => abc123* Chinese character string: return the first character
Html page The code is as follows:Copy code note the top_a1 ID. Js code The code is as follows:Copy code Function AD (id, did){ $. Post ("ajax. php", {"aid": id}, function (data ){If (data = '') // 0 { }Else { Optional (did)
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