PHP configuration file Processing Class code

/* * Source: http://www.xuehuwang.com/ * Author: Snow Fox Blog * Application: For processing configuration data * Collection and collation: bbs.it-home.org **/ Final class Config { Private $data = Array ();

Ten traits of a great programmer

One of the most recent concerns about how to become a good programmer has been our focus. Here are some of the qualities I think we need most: being good at solving problems. Both strenuous and lazy. Be able to understand other people's code. Be

PHP Kanji transcoding gbk->unicode (UTF8) encoding conversion

PHP Kanji transcoding gbk->unicode (UTF8) Class qswhgbk{ var $qswhData; function QSWHGBK ($filename = "qswhgbk.php") { $this->qswhdata=file ($filename); } function gb2u ($GB, $callback = "") { /****** (Qiushuiwuhen

PHP configuration File Application (Configure PDO vs. virtual host)

# Virtural hosts start the configuration of the virtual host Include conf/extra/httpd-vhosts.conf ServerAdmin kongdaoxian@gmail.com DocumentRoot "E:/skydao/apache2/htdocs/zendtest/public" ServerName

Analysis of PHP constructors and destructor functions

!--? PHP class counter { private static $count = 0; Function __construct () { self:: $count + +; } Function __destruct () { self::

PHP Recursive implementation of infinite classification of PHP formatted array

Database I use MySQL PDO but the whole idea is the same. $conn =mysql_connect (' localhost ', ' root ', ' 123 '); if (Mysql_errno ()) { printf (' Connection failed '. Mysql_error ()); } mysql_select_db (' Edeng ');

PHP reads the contents of the file and empties the file

Read File contents $fh = fopen ($path, "r+"); if (Flock ($FH, LOCK_EX)) {//Add write Lock $old _content=json_decode (Fread ($fh, FileSize ($path)), true); $old _content= $old _content. $new _content; Ftruncate ($fh, 0);

PHP Custom Array function Array_column

if (!function_exists (' Array_column ')) { function Array_column ($input, $columnKey, $indexKey =null) { $columnKeyIsNumber = (Is_numeric ($columnKey))? True:false; $indexKeyIsNull = (Is_null ($indexKey))? True:false;

PHP mb_convert_encoding Text Encoding conversion function

$STR = ' Scripting Academy: http://bbs.it-home.org '; Echo mb_convert_encoding ($str, "utf-8"); Convert Encoding to Utf-8 $STR = ' Programmer's house: http://bbs.it-home.org '; Echo mb_convert_encoding ($str, "Utf-8", "GBK"); Known

PHP Curl forged IP and antecedents

$headers [' client-ip '] = ' 202.103.229.40 '; $headers [' x-forwarded-for '] = ' 202.103.229.40 '; $HEADERARR = Array (); foreach ($headers as $n = = $v) { $HEADERARR [] = $n. ': '. $v; } Ob_

A simple example of PHP Curl spoofing IP

$ch = Curl_init (); curl_setopt ($ch, Curlopt_url, "http://localhost/index.php"); $r = rand (1,255); curl_setopt ($ch, Curlopt_httpheader, Array (' x-forwarded-for:8.8.8. $r, ' client-ip:125.8.8. ' $R)); Constructing IP

The function of converting PHP kanji into pinyin

function Pinyin ($_string, $_code= ' gb2312 ') { $_datakey = "A|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao |ce|ceng|cha ". "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|

PHP extract array split into multiple variables

$size = "Old Size"; Note the value of the last size variable. $a = Array ( "Color" = "Red", "Size" = "XXL", "Price" = "53"); Extract ($a); echo "color = $color"; echo "size = $size"; echo

PHP array Segmentation and array splicing

$fruits = Array ("Apple", "Banana", "Orange", "Pear", "Grape", "Lemon", "watermelon"); $subset = Array_slice ($fruits, 3); Print_r ($subset); Output Array ([0] = Pear [1] = Grape [2] = = Lemon [3] = = Watermelon) ?>

PHP Analog remote Login Sample code

!extension_loaded (' curl ') && die (' The curl extension are not loaded. '); $baseurl = ' http://127.0.0.1 ';//root address $login _url = $baseurl. ' /login.php?act=login ';//Login page address $get _url = $baseurl. '

PHP traversal directory with all of its files

function My_scandir ($dir) { $files =array (); if (Is_dir ($dir)) { if ($handle =opendir ($dir)) { while (($file =readdir ($handle))!==false) { if ($file! = '. ' && $file! = "...") { if (Is_dir ($dir. " /". $file))

Windows and Linux pseudo-static rule notation

[Isapi_rewrite] #这句是启用伪装静态规则 Rewriterule/([0-9]+). html/contents.php?w=$1 [i] Copy CodeAny address that begins with a number goes to Contents.php?w=$1, which represents the content received by the preceding ([0-9]+), and the

PHP Preg_match_all matches the picture in the article

$con = file_get_contents ("http://bbs.it-home.org/news/jb-1.html"); $pattern = "//]; Preg_match_all ($pattern, $con, $match); Print_r ($match); ?> Copy CodeOutput: Array ([0] = = Array ([0] = [1] = = [2] = =) [1] = =

PHP cc Attack defense and anti-quick Refresh code

Proxy IP Direct exit Empty ($_server[' Http_via ')) or exit (' Access Denied '); Prevent Quick refreshes Session_Start (); $seconds = ' 3 '; time period [s] $refresh = ' 5 '; Number of refreshes Setting up

PHP5 destructor Usage Example

/* * To change the template for this generated file go to * Window-preferences-phpeclipse-php-code Templates */ Class student{ Property Private $no; Private $name; Private $gender; Private $age;

Total Pages: 5208 1 .... 4814 4815 4816 4817 4818 .... 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.