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

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·½·¨ÀïÃæ¼Ó£º
return array('users'=>array(self::BELONGS_TO,'user','id'));
ÔÚarticlesµÄ¿ØÖÆÆ÷µ±Öе÷Ó÷½Ê½£º
$arr=articles::model()->with('users')->findAll();
ÔÚÕâÆäÖаÑuser±íµÄÊý¾Ý¾Í¹ØÁªÉÏÁË
·ÃÎÊ$arrÄÚÈÝ
foreach($arr as $val){
    echo $val->title;
    echo $val->content;
    //ÆäÖÐuser±íÖеÄÊôÐÔÖµ·ÃÎÊ
    echo $val->users->name;
}


Ïà¹ØÎĵµ£º

phpѧϰ±Ê¼Ç

 1¡¢$_SERVER['SCRIPT_NAME']¡¢$_SERVER['PHP_SELF']ºÍ$_SERVER['REQUEST_URI']Çø±ð
Àý×Ó:http://localhost/phpwind75/test.php/%22%3E%3Cscript%3Ealert(’xss’)%3C/script%3E%3Cfoo
$_SERVER['SCRIPT_NAME']Ö»»ñÈ¡½Å±¾Ãû£¬²»»ñÈ¡²ÎÊý,Êä³ö½á¹ûΪ:test.php;
$_SERVER['PHP_SELF']»ñÈ¡½Å±¾Ãûºó£¬Í¬Ê±»ñÈ ......

php ͨ¹ýinclude·½Ê½ÊµÏÖ¹ú¼Ê»¯¶àÓïÑÔ(i18n)

includeʵÏÖ¹ú¼Ê»¯
½«index.php½øÐз­Òë:
IndexÄÚÈÝ
1.         Index
2.         About us
ÎÒÃÇ¿ÉÒÔ½«index.phpÉèÖÃΪһ¸ö·­ÒëÄ£°æ£¬ËùÓгöÏÖ×Ö·ûµÄµØ·½£¬¶¼¶¨ÒåΪ±äÁ¿£¬Èç1£¬2²¿·ÖÉèÖÃΪ·­ÒëµÄ±äÁ¿$menu_index, $menu_aboutus.
......

ÄÇЩPHPÅãÎҶɹýµÄÈÕ×Ó

 ÎÞÒâ¼ä¿´µ½ÒÔÇ°·¢µÄÌû×Ó.»ØÒäÆðÄÇЩPHPµÄÈÕÈÕÒ¹Ò¹
http://www.phpfans.net/ask/discuss2/343326196.html
<?
class gzg//¸ÆÖиÆÀà
{
        var $x;//ÊôÐÔ
        function gzg()//¹¹Ô캯Êý,ĬÈϲ»³Ô¸ÆÖиÆ
              &n ......

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
//ÓÃÓÚÑéÖ¤ÂëÐòÁÐÉú³ÉµÈ..
function random($length) {
$hash = '';
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$max = strlen($chars)-1;
$length=4;//³¤¶È×ÔÐÐÉ趨
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ