phpÖÐµÄ Àà³£Á¿ Class Constants
It is possible to define constant values on a per-class basis remaining the same and unchangeable.
Constants differ from normal variables in that you don't use the $ symbol to declare or use them. Like static members, constant values cannot be accessed from an instance of the object (using $object::constant).
˵Ã÷£º const ³£Á¿ ²»Óà $ ·ûºÅ
const ²»¼Ó¹Ø¼ü×Ö private ÐÞÊÎ //Like static members,
²»ÄÜͨ¹ý ¶ÔÏó·ÃÎÊ¡£ Ö»ÄÜͨ¹ýclass·ÃÎÊ
Àý×Ó 19-15. Defining and using a constant
<?php
class MyClass
{
const constant = 'constant value';
function showConstant() {
echo self::constant . "\n";
}
}
echo MyClass::constant . "\n";
$class = new MyClass();
$class->showConstant();
// echo $class::constant; is not allowed
?>
Ïà¹ØÎĵµ£º
ת×Ô£ºÒÁÍ¼Íø[www.4ico.com]ÔÚ²ûÊöÀàµÄ¸ÅÄî֮ǰÎÒÃÇÀ´ÏÈËµËµÃæÏò¶ÔÏó±à³ÌµÄ¸ÅÄî£ºÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼Æ(Object-Oriented Programming£¬¼ò¼ÇΪOOP)Á¢ÒâÓÚ´´½¨Èí¼þÖØÓôúÂ룬¾ß±¸¸üºÃµØÄ£ÄâÏÖʵÊÀ½ç»·¾³µÄÄÜÁ¦£¬ÕâʹËü±»¹«ÈÏΪÊÇ×ÔÉ϶øÏ±à³ÌµÄÓÅʤÕß¡£Ëüͨ¹ý¸ø³ÌÐòÖмÓÈëÀ©Õ¹Óï¾ä£¬°Ñº¯Êý“·â×°”½ø±à³ÌËù±ØÐèµÄ&l ......
PHP100·ÖÒ³´úÂëÐ޸İ棬ËãαԴ´°É
ÏÂÃæÊDzâÊԵĹý³Ì:
Îļþpage.php,´úÂëÈçÏÂ:
<?php
/*
* author£ºphp100.com ÂÛ̳ nicholas_ng
*/
function page($page,$total,$phpfile,$pagesize=3,$pagelen=3){
$pagecode = '';//¶¨Òå±äÁ¿£¬´æ·Å·ÖÒ³Éú³ÉµÄHTML
$page = intval($page);//±ÜÃâ·ÇÊý×ÖÒ³Âë
$total = intval($ ......
array getimagesize(string filename)
¸Ãº¯Êý·µ»ØÒ»¸öËÄÎÞËØµÄ¾ØÕ󡢸æËßÄãËù¸øÎļþÃûµÄͼÏñ³ß
´ç¡£¸ÃÎļþµÄ¸ñʽ±ØÐëÊÇGIF,jpeg»òPNGÖеÄÈÎÒ»ÖÖ¡£
Ôª
ËØ
ÃèÊö
0
¿í¶ÈµÄÏñËØÊý
1
¸ß
¶ÈµÄÏñËØÊý
2
ͼÏñµÄÀàÐÍ£¨GIF=1,JPG=2,PNG=3)
3
ÔÚ
IMG±ê¼ÇÖпÉÓõ ......
<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"Cambria Mat ......
php±àÒëgd³ö´í!(Òѽâ¾ö)
ÔÚ32λubuntu9.04ÉϱàÒëphp5.2.12,µ½gdʱmake³ö´í:
ext/gd/libgd/.libs/gd_png.o: In function
`php_gd_gdImageCreatefromPngCtx':
/home/test/php-5.2.12/ext/gd/libgd/gd_png.c:142: undefined reference to
`png_check_sig'
collect2: ld returned 1 exit status
make: *** [sapi/cli/p ......