php³£Óú¯Êý3
<?php
class useful{
/*
* ³£Óú¯ÊýÀà
* ×÷ Õߣº¶à²ËÄñ
* ÁªÏµÓÊÏ䣺kingerq AT msn DOT com
* ´´½¨Ê±¼ä£º2005-07-18
* À´Ô´£ºhttp://blog.csdn.net/kingerq
*/
/*
* ¹¦ÄÜ£º¸ñʽ»¯Êý×Ö£¬ÒÔ±ê×¼MONEY¸ñʽÊä³ö
*/
function formatnumber($num){
return number_format($num, 2, ".", ",");
}
/*
* ¹¦ÄÜ£º¸ñʽ»¯Îı¾£¬½«\nת³É<br>µÈ
* ²ÎÊý£º$string À´Ô´×Ö·û´®
* ·µ»Ø£º´¦ÀíºóµÄ×Ö·û´®
*/
function formatstring($string = ""){
$string = preg_replace(array("/\s+/", "/\'/"), array(" ", "\"\""), $string);
$string = htmlspecialchars($string);
return nl2br($string);
}
/*
* ¹¦ÄÜ£º¸ñʽ»¯Îı¾Êä³ö
* ²ÎÊý $text ΪÐè¸ñʽ»¯µÄÎı¾ÄÚÈÝ
* É÷Óã¬Èç¹ûÈÃÓû§ÊäÈëµÄ¿ÉÖ´ÐдúÂëÔÚformatstring´¦Àíºó²åÈçÊý¾Ý¿â£¬È»ºóʹÓô˺¯Êý»áÈôúÂëÖ´ÐÐ
*/
function formatcontent($text){
$trans = get_html_translation_table(HTML_SPECIALCHARS);
$trans = array_flip($trans);
$text = strtr($text, $trans);
//$text = str_replace("\n", "<br>", $text);
//$text = str_replace(" ", " ", $text);
return $text;
}
/*
* ½«×Ö½Úת»»³ÉKb»òÕßMb...
* ²ÎÊý $numΪ×Ö½Ú´óС
*/
function bitsize($num){
if(!preg_match("/^[0-9]+$/", $num)) return 0;
$type = array( "B", "KB", "MB", "GB", "TB", "PB" );
$j = 0;
while( $num >= 1024 ) {
if( $j >= 5 ) return $num.$type[$j];
$num = $num / 1024;
$j++;
}
return $num.$type[$j];
}
/*
* ¹¦ÄÜ£º²»×ã3µÄ±¶ÊýλµÄÊý×Ö£¬ÓÃ0²¹×ã
* $num Ðè²¹³äµÄÊý×Ö
* ·µ»Ø²¹³äÍêÕûµÄÊý×Ö´®
*/
function prefix($num){
if( strlen( $num ) % 3 == 0 ) {
return $this-
Ïà¹ØÎĵµ£º
phpÖÐsubstrµÄÓ÷¨Ïê½â
php.netÖйØÓÚsubstrµÄ˵Ã÷ºÜ¼òµ¥:
start
If start is non-negative, the returned string will start at the start 'th position in string , counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so for ......
ÒÔÏÂΪʮ¸öĿǰ×îÁ÷ÐеĻùÓÚMVCÉè¼ÆÄ£Ê½µÄPHP¿ò¼Ü¡£
1. Yii
YiiÊÇÒ»¸ö»ùÓÚ×é¼þµÄ¸ßÐÔÄܵÄPHPµÄ¿ò¼Ü£¬ÓÃÓÚ¿ª·¢´ó¹æÄ£WebÓ¦Óá£Yii²ÉÓÃÑϸñµÄOOP±àд£¬²¢ÓÐ×ÅÍêÉÆµÄ¿âÒýÓÃÒÔ¼°È«ÃæµÄ½Ì³Ì¡£´ÓMVC£¬DAO/ActiveRecord£¬widgets£¬caching£¬µÈ¼¶Ê½RBAC£¬Web·þÎñ£¬µ½Ö÷Ì廯£¬I18NºÍL10N£¬YiiÌṩÁ˽ñÈÕWeb 2.0Ó¦Óÿª·¢ËùÐèÒªµÄ¼¸ ......
±¾ÎÄת×Ô:http://www.msphome.cn/post/119/
×î½üÒòΪҪ¶ÔÒ»¸öÏîÄ¿½øÐÐÖØ¹¹£¬ËùÒÔÒ»Ö±ÔÚÑо¿PHP¿ò¼Ü¡£´óÌå¿´ÁË¿´Zend Frameworks£¬×ÐϸѧϰÁËÏÂsymfony£¬·¢ÏÖÒ»¸öÁ¼ºÃµÄMVC Web¿ò¼Ü£¬×ãÒԸı俪·¢Ï°¹ß¡£µ«ÊÇÎÞÂÛÊÇZend Frameworks»¹ÊÇsymfony£¬¶ÔÓÚÖÐСÐÍÏîÄ¿µÄ¿ª·¢À´Ëµ¶¼¹ýÓÚÓ·Ö×£¬²¢²»ÄܺܺõÄÌáÉý¿ª· ......
ÔÚΪÓû§Ìṩ¶¯Ì¬ÄÚÈÝ·½Ã棬PHPºÍMySQLÊÇÒ»¸öÇ¿´óµÄ×éºÏ¡£ÕâЩÄêÀ´£¬ÕâÁ½Ïî²úÆ·ÒѾ¿çÔ½ÁËËüÃÇ×î³õµÄÓ¦ÓÃÎę̀£¬ÏÖÔÚ£¬Ò»Ð©ÊÀ½çÉÏ×æµÄÍøÕ¾Ò²ÔÚÓ¦ÓÃËüÃÇ¡£ËäÈ»ËüÃǵ±³õ¶¼ÊÇ¿ªÔ´Èí¼þ£¬Ö»ÄÜÔÚUNIX/LinuxÉÏÔËÐУ¬µ«¾¹ýÏ൱һ¶ÎʱÆÚµÄ·¢Õ¹£¬ËüÃÇÒÑÄÜÔÚWindowsƽ̨ÉÏÔËÐС£
ÔÚ±¾ÎÄÖУ¬ÎÒ½«Öð²½ÎªÄãÃÇ˵Ã÷ÈçºÎÔÚWindows»·¾³ÖÐ ......
<?php
error_reporting(0);//7all,0no
ini_set('display_errors', '0');
function myerror($errno, $errstr, $errfile, $errline)
{
echo "<BR>error type: [$errno] $errstr<br />\n";
echo "in line $errline of file $errfile<BR>";
} ......