PHP UBB Code conversion function

function Ubb ($string) {$searcharray [' bbcode_regexp '] = Array ("/s*[quote][nr]* (. +?) [Nr]*[/quote]s*/is ","/([Box= (#[0-9a-f]{6}|[ a-z]+)] [nr]* (. +?)] [Nr]* ([/box])/is ","/[url]s*

PHP Simple File Download filter judgment function

if (Strpos ($fileurl, ':/'))//remote file{Header ("Location: $fileurl");}else//Local Files{if ($d = = 0){Header ("Location:"). Site_url. $fileurl);}Else{$fileurl = file_exists ($fileurl)? Stripslashes ($fileurl): Phpcms_root. $fileurl//This may be a

PHP imagecreate Picture Generation Code

if (Isset ($GD) && $gd ==1 && $txt){Header ("Content-type:image/png");$txt = UrlDecode (Phpcms_auth ($txt, ' DECODE ', Auth_key));$imageX = strlen ($txt) *9;$im = @imagecreate ($imageX,) or Die ("Cannot Initialize new GD image Stream");$bgColor =

PHP image upload and generate watermark

Header (' content-type:text/html;charset=gb2312 ');$animation = new Imagick ();$animation->setformat ("gif");$image = new Imagick ('/skin/'. $_get["Ys"]. GIF ');$UNITL = $image->getnumberimages ();for ($i =0; $i $image->setimageindex ($i);$first =

PHP to add a watermark to the picture

Public function water ($filename, $water, $pos =0, $pct =80) {Load watermark Picture$info = $this->getimageinfo ($water);if (!empty ($info [0])) {$water _w = $info [0];$water _h = $info [1];$type = $info [' type '];$fun = ' imagecreatefrom '. $type;$

PHP imitates spiders to crawl content and analyze

Header ("CONTENT-TYPE:TEXT/HTML;CHARSET=GBK");$message =$_post[' message '];$contents = @file_get_contents ("$message");if ($contents = = "Forbidden") {$ch = Curl_init ();$timeout = 5;curl_setopt ($ch, Curlopt_url, "$message");curl_setopt ($ch,

tutorial on using PHP cookies

function Putcookie ($key, $value, $kptime =0, $pa = "/"){Global $cfg _cookie_encode;Setcookie ($key, $value, Time () + $kptime, $PA);Setcookie ($key. ' __ckmd5 ', substr (MD5 ($cfg _cookie_encode. $value), 0,16), time () + $kptime, $PA);} function

Introduction to the PHP file on the Portal tutorial

I. Submission of the form:The array that receives common form information is: $_get $_post $_requestThe functions that receive file upload information are: $_filesThe form cannot have the same name when you do multiple forms of uploading files at

PHP File Upload move_uploaded_file

Tenth chapter (1) file Upload (i)I. Submission of the form:The array that receives common form information is: $_get $_post $_requestThe functions that receive file upload information are: $_filesThe form cannot have the same name when you do

PHP Object-Oriented Detailed _ commonly used method of automatic invocation

The seventh chapter (10) Object-oriented detailed _ commonly used automatic Call method__tostring () is a method that is automatically invoked when an object is entered directly.__clone () A method that is invoked automatically when a newly cloned

Share a PHP remote image collection

The code is as follows:Copy code /* Use PHP to collect remote images. Basic process:1. Obtain the image address of the target website.2. Read the image content.3. Create a path to save the image and name the image.4. Write the image content.5.

Php reads textarea row by row and outputs line breaks to textarea

Let's just move on to the code: The code is as follows:Copy code $ Names = preg_split ('/rn/', $ _ POST ['textarea ']);Foreach ($ names as $ name ){// Todo something eg: echo $ name;} The value is very simple, so the value assignment is not

One-page tool code implemented by PHP

The total number of pages is a piece of wood with a certain length. The ruler slides on the block. On the premise that the two ends of the ruler cannot exceed the block: D. What we need to do is to find the starting point of the ruler on the block,

Map area data statistics using php-ajax loading data

The effect is shown in the following figure.HTMLLike the previous article on this site that used raphael. js to draw a map of China, first load the raphael. js library file and the chinamapPath. js path file in the head section. The code is as

Php reads all file names in the specified directory folder

Show all files in the directory The code is as follows:Copy code $ Dir = dirname (_ FILE _). "/../www.111cn.net/"; // enter another path here// PHP traverses all files in the folder$ Handle = opendir ($ dir .".");// Define an array used to store

PHP code 301 jump page instance

PHP code-only jump The code is as follows: Copy code Header ("Location: http://www.111cn.net /");?> However, the returned status code is 302.If you want

Using cookies in php to implement shopping cart instances

PHP shopping cart. There are many online stores on the internet. How do they implement shopping cart? Most websites use cookies. I wrote a simple example for your reference.Simple shopping cart with cookiesDatabase: The code is as follows:Copy code

PHP multi-process simple instance program

The code is as follows:Copy code $ Cmds = array (a, B, c, d );Foreach ($ cmds as $ cmd ){$ Pid = pcntl_fork ();If ($ pid =-1 ){Exit ("pid fork error "); }   If ($ pid) {// master process segment to control the number of sub-processesStatic $ max =

Summary of methods for adding correlated elements to php arrays

In "php array adding element method summary this article describes how to add elements to an array, so I want to add $ array = array ('title' => 'php ') what should we do with such elements.Array_push, array_pop, array_shift, and array_unshift

Php saves array variables to files

Total Pages: 12780 1 .... 10638 10639 10640 10641 10642 .... 12780 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.