?Class Login{var $username; User namevar $userpass; Passwordvar $userid; User IDvar $userlevel; User Level var $authtable = "Account"; Validating data tables var $usecookie =true; Save SessionID with Cookiesvar $cookiepath = '/'; Cookie Pathvar
Often see such statements:$file = fopen ($filename, ' r ') or Die ("Sorry, unable to open: $filename");Or here is the understanding, because in PHP does not distinguish between the data type, so $file can be int also can bool, so such statements do
Foreach traversal arrayWhen using arrays, we often need to traverse the array and obtain each key or element value. php provides some functions dedicated to traversing the array. This section describes the usage of foreach's array Traversal function.
Return value after ComparisonIf str1 and str2 are equal, 0 is returned.If str1 is smaller than str2, return If str1 is greater than str2, return> 0 (but different timing 1, the specific value size depends on the actual situation ).Example The code
Syntax: void set_time_limit (int seconds)Note: When PHP is executed in safe mode, set_time_limit () will not produce any results, unless it is disabled in safe mode or modified in the structure file (in PHP3, it is called php3.ini, PHP4 is called
What is the current page ($ CurrentPageID )?Now, you only need to give me another result set, so that I can display a specific result.Other parameters, such as the previous page ($ PReviousPageID), Next page ($ NextPageID), and total page ($
First, check the code:The function of this code is to find whether a string starts with a word. The code is as follows:Copy code $ Title = "Hello world .";$ Keyword = "you ";If (strpos ($ title, $ keyword) = 0 ){Echo "correct ";} Else {Echo
Apache pseudo-static html (URL Rewrite) setting methodPhpma: Open the configuration file httpd. conf of Apache.Phpma 2: # LoadModule rewrite_module modules/mod_rewrite # Remove1. apacheNow we can implement a pseudo-static page, and write down the
The simplest is to use php header to implementThe code is: The code is as follows:Copy code Header ("Location: http://www.111cn.net /");?>Or: Get the value through get or post before redirectingSometimes you can see http://www.xxx.com/url.php?
1. If the class method can be defined as static, it should be defined as static as much as possible, and its speed will be increased by nearly four times.2. $ row ['id'] is 7 times faster than $ row [id.3. echo is faster than print, and multiple
Ceil-integer in one method DescriptionFloat ceil (float value)Returns the next integer of no less than value. If the value has a decimal part, it is entered in one place. The type returned by ceil () is still float, because the float value range is
The mktime () function is very useful for date calculation and validation. It automatically calculates the correct value for an input out of the range: The code is as follows:Copy code ");Echo (date ("M-d-Y", mktime (,). " ");Echo (date ("M-d-Y"
The forced type conversion in PHP is very similar to that in C: add the target type enclosed in parentheses before the variable to be converted: The code is as follows:Copy code $ Foo = 10; // $ foo is an integer.$ Bar = (boolean) $ foo; // $
I. Basics of functionsThe php Tutorial provides a large number of functions and allows you to customize the functions,Php function definition instance The code is as follows:Copy code Function myCount ($ inValue1, $ inValue2){$ AddValue = $
If you use php +-*/to calculate the floating point number, you may encounter some calculation result errors, such as echo intval (0.58*100); 57 is printed instead of 58, this is actually a bug that the underlying binary of the computer cannot
1. I used it before. When submitting form post, the url of the action passes the get parameter, which can be obtained by the server: The code is as follows:Copy code Print_r ($ _ GET );Print_r ($ _ POST );?> Name: Age: 2. If your form
Chinese character regular expression in gbk encoding1. Determine whether the string is full of Chinese characters The code is as follows:Copy code $ Str = 'All are Chinese character test ';If (preg_match_all ("/^ ([x81-xfe] [x40-xfe]) + $/", $
Download the "Ewebeditor" PHP editor.1. Add the following code before : (get the content edited in ewebeditor) The code is as follows:Copy code (2) the following code embeds ewebeditor into a webpage: The code is as follows:Copy code * ***
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