Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHPÊý¾ÝÀàÐÍת»»

PHPÊý¾ÝÀàÐÍת»»
PHPµÄÊý¾ÝÀàÐÍת»»ÊôÓÚÇ¿ÖÆ×ª»»£¬ÔÊÐíת»»µÄPHPÊý¾ÝÀàÐÍÓУº
£¨int£©¡¢£¨integer£©£º×ª»»³ÉÕûÐÎ
£¨float£©¡¢£¨double£©¡¢£¨real£©£º×ª»»³É¸¡µãÐÍ
£¨string£©£º×ª»»³É×Ö·û´®
£¨bool£©¡¢£¨boolean£©£º×ª»»³É²¼¶ûÀàÐÍ
£¨array£©£º×ª»»³ÉÊý×é
£¨object£©£º×ª»»³É¶ÔÏó
PHPÊý¾ÝÀàÐÍÓÐÈýÖÖת»»·½Ê½£º
ÔÚҪת»»µÄ±äÁ¿Ö®Ç°¼ÓÉÏÓÃÀ¨ºÅÀ¨ÆðÀ´µÄÄ¿±êÀàÐÍ
ʹÓÃ3¸ö¾ßÌåÀàÐ͵Äת»»º¯Êý£¬intval()¡¢floatval()¡¢strval()
ʹÓÃͨÓÃÀàÐÍת»»º¯Êýsettype(mixed var,string type)
 µÚÒ»ÖÖת»»·½Ê½£º (int)  (bool)  (float)  (string)  (array) (object)
Îı¾²é¿´¸´ÖÆ´úÂë´òÓ¡¹ØÓÚ
<?php   
$num1=3.14;   
$num2=(int)$num1;   
var_dump($num1); //Êä³öfloat(3.14)   
var_dump($num2); //Êä³öint(3)   
?>  
<?php
$num1=3.14;
$num2=(int)$num1;
var_dump($num1); //Êä³öfloat(3.14)
var_dump($num2); //Êä³öint(3)
?>
µÚ¶þÖÖת»»·½Ê½£º  intval()  floatval()  strval()
Îı¾²é¿´¸´ÖÆ´úÂë´òÓ¡¹ØÓÚ
<?php   
$str="123.9abc";   
$int=intval($str);     //ת»»ºóÊýÖµ£º123   
$float=floatval($str); //ת»»ºóÊýÖµ£º123.9   
$str=strval($float);   //ת»»ºó×Ö·û´®£º"123.9"    
?>  
<?php
$str="123.9abc";
$int=intval($str); //ת»»ºóÊýÖµ£º123
$float=floatval($str); //ת»»ºóÊýÖµ£º123.9
$str=strval($float); //ת»»ºó×Ö·û´®£º"123.9"
?>
µÚÈýÖÖת»»·½Ê½£º  settype();
Îı¾²é¿´¸´ÖÆ´úÂë´òÓ¡¹ØÓÚ
<?php   
$num4=12.8;   
$flg=settype($num4,"int");   
var_dump($flg);  //Êä³öbool(true)   
var_dump($num4); //Êä³öint(12)   
?>  
<?php
$num4=12.8;
$flg=settype($num4,"int");
var_dump($flg); //Êä³öbool(true)
var_dump($num4); //Êä³öint(12)
?>
365PHPÃâ·ÑÊÓÆµ½Ì³ÌÏÂÔØ£º  PHP½Ì³ÌÊÓÆµ,Ãâ·ÑÊÓÆµÏÂÔØ -PHPÊý¾ÝÀàÐÍת»»
×÷ÕߣºÂíÃ÷@PHPÅàѵ PHPÐÞ¶©1.0 2009-09
365PHP£¬ÖйúPHPÔÚÏßÅàѵ


Ïà¹ØÎĵµ£º

PHPʵÏÖÎļþµÄ¶ÁºÍд¹¦ÄÜ

½øÐÐÎļþµÄ¶ÁºÍд£¬ÏÈ´ò¿ªÒ»¸öÎļþ£¬È»ºó¿ªÊ¼¶Á»òÕßдÎļþ£¬×îºóÔÙ¹ØÏµÕâ¸öÎļþ×ÊÔ´¡£
È磬ÎļþµÄ¶Á²Ù×÷£º
<?php
$file = fopen('your file path','r');
while(!feof($file)){ //µ±Ã»ÓжÁÈ¡µ½Îļþ½á⣬¼ÌÐøÑ­»·¶ÁÈ¡²Ù×÷
$line = fgets($file); //¶ÁÈ¡µ½Ò»ÐеÄÄÚÈÝ
echo $line.'<br/>';
}
fclose($file) ......

PHP smartyѧϰ

phpÎļþ
<?php
mysql_connect("localhost","","");
mysql_query("set names 'gb2312'");
mysql_select_db("shop");
$sqlstr="select * from goods";
require 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;//ÉèÖø÷¸öĿ¼µÄ·¾¶£¬ÕâÀïÊǰ²×°µÄÖØµã
$smarty->template_dir ="smarty/templates/templa ......

Àí½âPHPÖеÄMVC±à³ÌÖ®MVC¿ò¼Ü¼ò½é

¡¾Ê²Ã´ÊÇMVC£¿¡¿
        MVCÊÇÒ»¸ö¿ÉÒÔÈÃÄã°Ñ“Èý¸ö²¿·Ö£¨¼´MVCµÄÈ«³Æ£¬Model¡¢ View¡¢Controller£©”гµ÷µØ×é³ÉÒ»¸ö¸´ÔÓÓ¦ÓóÌÐòµÄ¸ÅÄî¡£Ò»Á¾Æû³µ¾ÍÊÇÒ»¸öÔÚÏÖʵÉú»îÖзdz£ºÃµÄMVCÀý×Ó¡£ÎÒÃÇ¿´³µ¶¼¿´Á½¸öView£¨ÏÔ Ê¾£©²¿·Ö£ºÄÚ²¿ºÍÍⲿ¡£¶øÕâÁ½¸ö¶¼Àë²»¿ªÒ»¸öController£ ......

¶þ½øÖÆÈ¨ÏÞ¿ØÖÆPHPÀà

<?php
/* ¶þ½øÖÆÈ¨ÏÞ¿ØÖÆPHPÀà
* ×÷ Õß: ¶à²ËÄñ
* ÓÊ Ïä: kingerq AT QQ DOT com
* À´ Ô´£ºhttp://blog.csdn.net/kingerq/archive/2009/10/22/4714223.aspx
* ´´½¨Ê±¼ä: 2009-10-22
*/
class binPower{

var $power = "";
//ȨÏÞ´æÖü±äÁ¿,Ê®½øÖÆÕûÊý

function __construct($power) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ