if () endif substitution syntax

if (expression): ?> Statement endif ?> Copy CodeThe above notation is the alternative syntax for PHP's Process control.There are several alternative syntaxes in the PHP Process

PHP get and Set variable types

gettype-getting variable typesGrammar:String GetType (mixed $var)The possible values for the returned string are:BooleanIntegerDoubleStringArrayObjectResourceNullUnknown typeAttention:Do not use GetType () to test for a type, because its returned

PHP code to calculate file size

function Dirsize ($directoty) { $dir _size=0; if ($dir _handle= @opendir ($directoty)) { while ($filename =readdir ($dir _handle)) { $subFile = $directoty. Directory_separator. $filename; if ($filename = = '

PHP Check Date function Checkdate Use example

Grammar Integer checkdate (int%month, int $Day, int $Year); Demo Code echo "2/29/1900"; Checkdate (2, 1900)? print "is Valid":p rint "was not Valid"; echo "\ n"; echo "2/29/2000";

Image upload and use ImageMagick to generate thumbnail images

With ImageMagick, you can easily and quickly create thumbnails that are much easier to use than PHP. Location to upload main image: $mainDir = $_server[' Document_root '). ' /images/l/'; Location to create the thumb

Getting Started with PHP (basic, variable, constant, structure statement)

php Getting Started (basic, variable, constant, structure statement), a friend of the need can refer to. Basic knowledge: ?> can omit string connectors are. Comments//Variables variables must have a first letter of $, a letter or underscore "_"

Ultra-Lightweight Open source PHP framework: Fatfreeframework

A powerful and easy-to-use PHP microarchitecture designed to help you build dynamic and powerful Web applications-fast!The entire frame size is less than 60kb, although lightweight, but not simple. The support for routing, ORM, and MVC is very good.

PHP version arbitrary binary conversion

$int = 36; $str =array (); $flag = 0; Echo chr ($int%36+87); while ($int!=0) { if ($int%36 else $str [$flag ++]=chr ($int%36+87); $int/=36; } for ($i = $flag; $i >=0; $i-=1) if ($str [$i]!=0

PHP for HTTP login Verification

/* HTTP Authentication Determine the route page Write log */ disabling Error Reporting////////////// error_reporting (0); HTTP Authentication//////////// if (!isset ($_server[' Php_auth_user ')) {

PHP processing the file download code

Using the PHP code provided on the server to download, you can specify the name of the downloaded file, you can dynamically specify the contents of the file Local file that should is send to the client $local _file = ' test.zip ';

The HP implementation calculates the number of weeks in a year, returning the start and end time of one weeks (optional return timestamp or date)

function Getweekstartandend ($year, $week =1) { Header ("Content-type:text/html;charset=utf-8"); Date_default_timezone_set ("Asia/shanghai"); $year = (int) $year; $week = (int) $week; Calculates the total year of the week by

PHP uses HTTP_BUILD_QUERY,PARSE_URL,PARSE_STR to create and parse URLs

rfc

PHP uses HTTP_BUILD_QUERY,PARSE_URL,PARSE_STR to create and parse URLs, and the friends you need can refer to them.1.http_build_queryHttp_build_query can create a request string after UrlEncode. String Http_build_query (mixed

Common functions and keywords in the basic PHP section

BOOL Setcookie (String $name [, String $value [, int $expire = 0 [, String $path [, String $domain [, bool $secure = Fals e [, bool $httponly = FALSE]]]] Explain:this requires that's calls to this function prior to any output, including and

Get the last day of a month or the number of days of a month

Get the last day of a month or the number of days of a month function Getmonthlastday ($month, $year) { Switch ($month) { Case 4: Case 6: Case 9: Case 11: $days = 30; Break Case 2:

PHP code for non-deforming screenshots

function My_image_resize ($src _file, $dst _file, $new _width, $new _height) { $src _img=imagecreatefromjpeg ($src _file); $w =imagesx ($src _img); $h =imagesy ($src _img); $ratio _w=1.0 * $new _width/$w; $ratio _h=1.0 *

Picture Shrink print PHP class

/** * Picture shrinkage Water printing type * */ Class Cls_photo { protected $waterrate = 0.2; The scale of the watermark icon on the picture protected $width = 300; Thumbnail default width protected $height =

Scheduled (scheduled) tasks implemented by PHP

Sometimes in order to adjust the interface periodically, the program needs to run automatically. There are two ways to do this from the Internet: 1, Ignore_user_abort () Ignore_user_abort () functions with Set_time_limit (0) and sleep ($interval)

PHP limit file Download speed

Local file that should is send to the client $local _file = ' test-file.zip '; filename that the user gets as default $download _file = ' your-download-name.zip '; Set the download rate limit (= 20,5 kb/s)

Get the PHP code that the client uses for the operating system type

function Useros () { $user _osagent = $_server[' http_user_agent '); if (Strpos ($user _osagent, "NT 6.1")) { $visitor _os = "Windows 7"; } elseif (Strpos ($user _osagent, "NT 5.1")) { $visitor _os = "Windows XP (SP2)";

PHP Build GUID (UUID)

2.jpg (3.82 KB, download number: 2) Download attachments 2016-1-2 15:52 Upload /** * Generate GUID (UUID) * @access Public * @return String * @author Knight */

Total Pages: 5208 1 .... 3132 3133 3134 3135 3136 .... 5208 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.