php Öеĵ¥ÒýºÅ Ë«ÒýºÅ ·´ÒýºÅµÄ×÷ÓÃ
×Ö·û´®µÄд·¨
×Ö·û´®ÒÔµ¥¡¢Ë«»òµ¹ÒýºÅΧס·Ö±ðÓв»Í¬µÄÒåÒâ¡£
µ¥ÒýºÅ
ÀýÈ磺
$str = 'An apple a day keeps the docter away.'
µ±×Ö·û´®³öÏÖ ' ·ûºÅʱ£¬±ØÐë¼ÓÉÏ£º
'I'm wing'
Ó¦¸Ä³É£º
'I'm wing'
²Å¶Ô£¬ÆäÖÐ ' ¼´³ÆÎªÌøÍÑ×Ö·û (escape character)¡£
Ë«ÒýºÅ
ÒÔË«ÒýºÅΧסµÄ×Ö·û´® PHP »á¶Ô¸Ã×Ö·û´®×ö variable interpolation µÄ¶¯×÷£¬Ò༴×ö±äÁ¿µÄÈ¡´ú£º
$name = "Wing";
echo 'Name: $name';
echo "Name: $name";
Ö´Ðнá¹ûΪ£º
Name: $name
Name: Wing
ÔÚË«ÒýºÅÀïµÄ×Ö·û´®Èç¹ûÓÐ $ (dollar sign)£¬Ö»Òª¸Ä³ÉÌøÍÑ×ÖÔªµÄд·¨¼´¿É£º
$total = 12000
echo "Total: $ $total"; //Êä³ö Total: $ 12000
ÔÚ×ö variable interpolation ʱ£¬±äÁ¿Ãû³ÆÊÇÒÔÒ»¸öÒÔÉϿոñ×öΪ½çÏߣ¬ÀýÈ磺
$n_file = 5;
if ($n_file == 1) {
echo "There are $n_file.";
} else {
echo "There are $n_files.";
}
µ± $n_file ²»Îª 1 ʱ£¬"There are $n_files." PHP Ëù¿´µ½µÄ±äÁ¿Îª $n_files£¬¶ø²»ÊÇÕýÈ·µÄ $n_file£¬ËùÒÔ±ØÐë¸Ä³É£º
$n_file = 5;
if ($n_file == 1) {
echo "There are $n_file.";
} else {
echo "There are {$n_file}s.";
}
µ¥ÒýºÅÄÚµÄË«ÒýºÅ£¬»òÊÇË«ÒýºÅÄڵĵ¥ÒýºÅ¶¼ÊÓΪÓÐЧ×Ö·û£¬²»ÐèʹÓÃÌøÍÑ×Ö·û£¬ÀýÈ磺
echo "I'm a happy bird.";
echo 'I'm a happy "bird"!';
Êä³ö½á¹ûΪ£º
I'm a happy bird.
I'm a happy "bird"!
·´ÒýºÅ
ÀûÓ÷´ÒýºÅ¿ÉÒÔÖ´ÐÐ Unix ϵÄÃüÁ²¢´«»ØÖ´Ðнá¹û¡£ÀýÈ磺
echo `ls -l *.txt`;
±íʾ½« ls -l *.txt ÃüÁîµÄÖ´Ðнá¹ûÊä³ö£¬ÒÔ·´ÒýºÅΧסµÄ×Ö·û´®ÎªÒªÖ´ÐÐµÄ UNIX Ö¸Áî¡£
Ïà¹ØÎĵµ£º
<?php
/**
* ʹÓù²ÏíÄÚ´æµÄPHPÑ»·ÄÚ´æ¶ÓÁÐʵÏÖ
* Ö§³Ö¶à½ø³Ì, Ö§³Ö¸÷ÖÖÊý¾ÝÀàÐ͵Ĵ洢
* ×¢: Íê³ÉÈë¶Ó»ò³ö¶Ó²Ù×÷,¾¡¿ìʹÓÃunset(), ÒÔÊÍ·ÅÁÙ½çÇø
*
* @author wangbinandi@gmail.com
* @created 2009-12-23
*/
class SHMQueue
{
private $maxQSize = 0; // ¶ÓÁÐ×î´ó³¤¶È
private $front = 0; ......
ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼ÆË¼ÏëÓë×î¼Ñʵ¼ù
·¢ÐÅÈË: wesley (ÐÄÖеÄÉÁÖ), ÐÅÇø: Java
±ê Ìâ: ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼ÆË¼ÏëÓë×î¼Ñʵ¼ù
·¢ÐÅÕ¾: ˮľÉçÇø (Thu Dec 24 01:55:04 2009), Õ¾ÄÚ
×ªÔØ×Ô±¾ÈËÐÂÀ˲©¿Í
http://blog.sina.com.cn/s/blog_53923f940100g7xx.html
£¨ÀÏÎâ×ÔÑÔ×ÔÓ
×î½üƵ·±ÌýË ......
ÕûÀí»î£ºPHPµÄÈÕÆÚʱ¼äº¯Êýdate()
1£¬Äê-ÔÂ-ÈÕ
echo date('Y-m-j');
2007-02-6
echo date('y-n-j');
07-2-6
´óдY±íʾÄêËÄλÊý×Ö£¬¶øÐ¡Ð´y±íʾÄêµÄÁ½Î»Êý×Ö£»
Сдm±íʾÔ·ݵÄÊý×Ö(´øÇ°µ¼)£¬¶øÐ¡Ð´nÔò±íʾ²»´øÇ°µ¼µÄÔ·ÝÊý×Ö¡£
echo date('Y-M-j');
2007-Feb-6
echo date('Y-m-d');
2007-02-06
´óдM±íʾÔÂ·ÝµÄ ......
ÔÐÍ£ºstring substr ( string $string , int $start [, int $length ] )£¬Ëü¿ÉÒÔÓÃÓÚÔÚÒ»¸ö½Ï³¤µÄ×Ö·û´®ÖвéÕÒÆ¥ÅäµÄ×Ö·û´®»ò×Ö·û¡£$stringΪËùÒª´¦ÀíµÄ×Ö·û´®£¬$startΪ¿ªÊ¼Ñ¡È¡µÄλÖã¬$lengthΪҪѡȡµÄ³¤¶È(µ±ËüÊǸºÊýʱΪ¸ºÊýʱ±íʾÓÒÆðÊýÆðµÄλÖÃ)¡£
Àý£º
<?php
$rest1 = substr("abcdef", 0, 0); // returns ......
ÔÚʹÓÃphpÖÐʹÓÃÊý¾Ý¿âÊÂÎñ´¦Àí²¢²»¸´ÔÓ£¬Ö÷ÒªÓõ½µÄÊÇmysqliÀàµÄ3¸ö³ÉÔ±º¯Êý¡£
£¨1£©autocommit£¨bool mode£©£¬ÉèÖÃÊý¾Ý¿â×Ô¶¯Ìύ״̬¡£µ±modeΪTRUEʱ£¬´ò¿ª×Ô¶¯Ìá½»ÉèÖ㬵±modeΪFASLEʱ£¬¹Ø±Õ×Ô¶¯ÉèÖá£Ëùν×Ô¶¯Ìá½»£¬¾ÍÊÇMYSQLÿִÐÐÒ»ÌõSQLÓï¾ä£¬¸ÃSQLÓï¾äµÄÖ´Ðнá¹ûÂíÉÏÉúЧ¡£¶ø·Ç×Ô¶¯Ìύʱ£¬ÔòÖ´Ðнá¹ûÒªÒ»Ö±µ½ ......