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

[×ªÔØ]PHP ¼ÆËãʱ¼ä²î

ÎÒÃdz£³£ÔÚÍøÕ¾ÉÏ¿´µ½Ä³ÆªÎÄÕ·¢±íÓÚ“3Ììǰ”£¬“5¸öÔÂǰ”£¬“4Äêǰ”¡£ÏÂÃæÕâ¸öº¯Êý¾ÍÌṩÁ˼ÆËãÕâ¸öʱ¼ä²îµÄ¹¦ÄÜ¡£
<?php
/**
* ʱ¼ä²î¼ÆËã
*
* @param Timestamp $time
* @return String Time Elapsed
* @author Shelley Shyan
* @copyright http://phparch.cn (Professional PHP Architecture)
*/
function time2Units ($time)
{
   $year   = floor($time / 60 / 60 / 24 / 365);
   $time  -= $year * 60 * 60 * 24 * 365;
   $month  = floor($time / 60 / 60 / 24 / 30);
   $time  -= $month * 60 * 60 * 24 * 30;
   $week   = floor($time / 60 / 60 / 24 / 7);
   $time  -= $week * 60 * 60 * 24 * 7;
   $day    = floor($time / 60 / 60 / 24);
   $time  -= $day * 60 * 60 * 24;
   $hour   = floor($time / 60 / 60);
   $time  -= $hour * 60 * 60;
   $minute = floor($time / 60);
   $time  -= $minute * 60;
   $second = $time;
   $elapse = '';
   $unitArr = array('Äê'  =>'year', '¸öÔÂ'=>'month',  'ÖÜ'=>'week', 'Ìì'=>'day',
                    'Сʱ'=>'hour', '·ÖÖÓ'=>'minute', 'Ãë'=>'second'
                    );
    foreach ( $unitArr as $cn => $u )
    {
        if ( $$u > 0 )
        {
           $elapse = $$u . $cn;
            break;
&


Ïà¹ØÎĵµ£º

PHP Security for Deployers

PHP Security for Deployers
If you're a Developer
READ THIS and then work with your SysAdmins to step through any and all the layers of security designed to protect your apps.
Example:
Traffic must first pass through a SPI firewall (ensure that ONLY necessary ports/protocols are permitted; en ......

PHPµÄÈýµã¾«»ª½éÉÜ

 ÎÒ·¢ÏֺܶàµÄPHP³ÌÐòÔ±£¬ÓÈÆäÊÇѧϰ»¹²»ÊǺܾõ쬶¼²»ÖªµÀPHPµÄ¾«»ªËùÔÚ¡£Perlµ±ÄêÈçºÎÔÚÉ̽ç³öÃû£¿ÆäÇ¿´óµÄÕýÔò±í´ïʽ¡£¶øPHPÄØ£¿ËûÊÇÒ»ÃÅ´ÓUnixÏ·¢Õ¹ÆðÀ´µÄÓïÑÔ£¬µ±È»Ò²¾Í¼Ì³ÐÁËPerlµÄºÜ¶àÌØµã£¬Í¬Ê±CµÄÓŵ㶼ÓС£¿ìËÙ¡¢¼ò½à¡¢Ã÷ÁË£¬ÓÈÆäÊÇC³ÌÐòÔ±£¬PHPÊÇÖÁ°®£¬ÎÒ¾ÍÊÇÉî°®×Å“PHP”£¨¶¼ÍüÁËÅ®ÓÑÁË:)£©¡ ......

PHPÁ¬½ÓMysqL

Á¬½Ó£º
$conn=mysql_connect ("localhost:3306", "username", "password");
mysql_select_db("DBname");
¶Á£º
$exec="select * from stu";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
    echo $rs->id." & ......

phpµÄyii¿ò¼Ü¹ØÁª²éѯ

¼ÙÈçÓÐÁ½¸ö±í£º user  ºÍ articles ±í
½á¹¹£º
user£º £¨id, name£©
articles: (id,user_id,title,content)
ÆäÖÐuser.id ºÍ user_id ¹ØÁª
ÔÚuserµÄ modelÖÐµÄ relations·½·¨ÀïÃæ¼Ó£º
return array('articles'=>array(self::HAS_MANY,'articles','user_id'));
ÔÚarticlesµÄ modelÖÐµÄ relations·½·¨ÀïÃæ¼Ó£º
......

PHPÖÐmysql_fetch_array()ºÍmysql_fetch_row()µÄÇø±ð

 ×î½üÔÚ×öPHPÓëÊý¾Ý¿â½»»¥µÄproject£¬¼±ÓÚÇó³É£¬Ä£·ÂÁËÏÂÀý×ӾͿªÊ¼¶¯ÊÖ£¬½á¹ûÎó°Ñmysql_fetch_arrayд³ÉÁËmysql_fetch_row,囧ÊÂÀ´ÁË£¬·¢ÏÖ·µ»ØµÄÊý×é¾ÓÈ»ÊÇindex=>valueµÄÐÎʽ£¬¶øÃ÷Ã÷¼ÇµÃÊÇfield name=>valueµÄ¹þ£¬²éÊÖ²á²ÅÃ÷°×¡£
1. mysql_fetch_arrayµÄº¯ÊýÔ­ÐÍÊÇ
array mysql_fetch_array ( resour ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ