Const can be used in classes, define not
Const defines a class member variable in a class that is already defined and cannot be changed. Define can only define global constants and cannot define class member variables
Const can only be named
The key code is as follows:
Get login user Information function Getopenid ($appid, $appsecret, $code) {$url = "Https://api.weixin.qq.com/sns/oauth2/access_token? Appid= ". $appid." &secret= ". $appsecret. " &code= ". $code."
This article describes the YII2 simple implementation of the multi-language configuration method, share to everyone for your reference, as follows:
1. Add the configuration file
' i18n ' = [' translations ' and ' = ' * ' = ' = ' class ' = ' Yii\
////////
//
Zhangshulin-Hui Jia Studio
//
Module name:woods-bhtml.php
Abstract: Generating a static HTML handler end
version:2.0
Copyright 1001-1006, All rights reserved for Hui Jia Studio
The software for
PHP database Operation class, to realize the table additions and deletions, to get the number of rows, query multiple data records, left connection query, create data table structure. Feature-rich, convenient to move the value, the need for friends,
Create function with an exception
function Checknum ($number)
{
if ($number >1)
{
throw new Exception ("Value must be 1 or below");
}
return true;
}
Trigger exception
This section is about the practice of PHP arrays, using a one-dimensional array averaging example, for everyone to learn the reference. Requirements: Enter 5 numbers in the input box (enter those 5 numbers separated by a space), use a
Web Online Group chat (ipad interface) source code all in Ichat.zip compressed package The main consists of three files: index.php: Form values get nickname file, pass value tochat.phpFile Chat . PHP : main file, get index.php value, determine
For you to introduce a PHP analog HTTP authentication example, mainly combining the header () function and $php_auth_user, $PHP _AUTH_PW global variable method to create a basic authentication mechanism for everyone to learn the reference.The code
Cmszu can manage data for multiple websites.Like SEO, information, collection, classification, download, pictures and so on can be classified to each of the site display (of course, the respective site can also have their own classification and
PHP is sensitive to variables, constants, and casing. Not sensitive to class name, method name capitalization. Not sensitive to null,false,true and so on, but also sensitive to the configuration parameters in php.ini. This article summarizes the
This article introduces, in PHP using Intval () for int conversion, encountered an abnormal situation, and the solution, for your reference.Test code for PHP's Intval () function:
HTML code:Run Result: float (945) int (944) float (945) int (94
/**
* Calculates the year, month, week, and day of two date intervals
* Edit bbs.it-home.org
*/
function format ($a, $b) {
Check the two date size, the default is small after large, if the former large after the small swap
echo ceil (4.3); 5
echo ceil (9.999); 10
?>
Copy Code2, floor-to take the whole method of rounding the float floor (float $value) returns the next integer not less than value, rounding out the fractional part of value. The
This article describes an example of verifying email address format in PHP, with the need for a friend to refer to.In PHP code, often encounter the verification of the correct format of the mailbox, this section to share an entry-level reference
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.