<?php
class Model_Data_FocusData{
....
public function getData(){...}
}
class Model_Data_IndexData{
....
public function getData(){...}
}
?>
ÓÐÕâô¼¸¸öÀ࣬ϣÍûÄܹ»×Ô¶¯µÄ¸ù¾Ý²ÎÊýÀ´µ÷Óò»Í¬µÄÀà´¦ÀíÊý¾Ý¡£
¿´µ÷ÓÃÄ£¿é£º
<?php
function getData($act){
$class = "Model_Data_{$act}Data";
$model = new $class();
return $model->getData();
}
?>
Õâ¸ö¿é¿´ÆðÀ´Ã»ÓÐÒ»µãÎÊÌ⣬ÔÚWAMPÏÂÔËÐÐҲûÓÐÎÊÌâ¡£
µ«ÊÇÒÆÖ²µ½LAMPºó£¬·¢ÏÖÖ´Ðе½ÕâÒ»¶Î´úÂëµÄʱºòÖжÏÁË¡£
ÎÊÌâÔÚÄÄÀïÄØ£¿
$class = "Model_Data_{$act}Data";
$model = new $class();
¿´ÕâÀ"Model_Data_{$act}Data"; »»³É "Model_Data_".$act."Data";ºó£¬Õâ¶Î´úÂëÓÖͨ¹ýÁË¡£
Óɴ˵óö½áÂÛ£º
php×Ö·û´®ÖмÓÈë´óÀ¨ºÅÒýÓñäÁ¿Ê±£¬²¢Ã»ÓÐÁ¢¼´´¦Àí¸Ã±äÁ¿£¬¶øÊÇ×îÖÕʹÓõÄʱºò´¦Àí£¬±ÈÈ磺echoµÄʱºò£¬echoÕâ¸öÃüÁî¾ßÓнâÎö×Ö´®ÖбäÁ¿¹¦ÄÜ£¬¶ø new ¹Ø¼ü´ÊÏÔÈ»²»¾ß±¸¡£ ......
С±à֮ǰҲÔø±¨µ¼¹ýPHP¿ª·¢ÈËÔ±ÈÝÒ׺öÂԵļ¸µã¾«»ª,³ýÁËһЩ¾«»ª¼¼Êõ·½·¨Í⣬ºÜ¶àϸ΢֮´¦Ò²ÊdzÌÐòÔ±
ÃÇÈÝÒ׺öÂԵģ¬ÏÂÃæÎÒÃÇΪÄú×ܽáÁË10¸ö¹ØÓÚPHPÄã¿ÉÄܲ»ÖªµÀµÄÊÂÇé¡£
¡¡¡¡¹ØÓÚPHP¸ü¶àÄÚÈÝ£¬»¶Ó·ÃÎÊ£ºPHP¿ª·¢»ù´¡ÈëÃÅ
¡¡¡¡1.ʹÓÃip2long() ºÍlong2ip()º¯ÊýÀ´°ÑIPµØַת»¯³ÉÕûÐÍ´æ´¢µ½Êý¾Ý¿âÀï¡£
¡¡¡¡ÕâÖÖ·½·¨°Ñ´æ´¢¿Õ¼ä½µµ½Á˽ӽüËÄ·ÖÖ®Ò»(char(15)µÄ15¸ö×Ö½Ú¶ÔÕûÐεÄ4¸ö×Ö½Ú)£¬¼ÆËãÒ»¸öÌض¨µÄµØÖ·ÊDz»ÊÇÔÚÒ»¸öÇø¶ÎÄÚÒ³¸ü¼òµ¥ÁË£¬
¶øÇÒ¼Ó¿ìÁËËÑË÷ºÍÅÅÐòµÄËÙ¶È(ËäÈ»ÓÐʱ½ö½öÊÇ¿ìÁËÒ»µã)¡£
¡¡¡¡2.ÔÚÑéÖ¤EmailµØÖ·µÄʱºòʹÓÃcheckdnsrr() º¯ÊýÑéÖ¤ÓòÃûÊÇ·ñ´æÔÚ¡£
¡¡¡¡Õâ¸öÄÚÖú¯ÊýÄܹ»È·ÈÏÖ¸¶¨µÄÓòÃûÄܹ»½âÎö³ÉIPµØÖ·¡£¸Ãº¯ÊýµÄPHP
ÎĵµµÄÓû§ÆÀÂÛ²¿·ÖÓÐÒ»¸ö¼òµ¥µÄÓû§×Ô¶¨Ò庯Êý£¬Õâ¸öº¯Êý»ùÓÚcheckdnsrr()£¬ÓÃÀ´ÑéÖ¤ email
µØÖ·µÄºÏ·¨ÐÔ¡£¶ÔÓÚÄÇЩÈÏΪ×Ô¼ºµÄEmailµØÖ·ÊÇmemory@wwwphp100.net¶ø²»ÊÇmemory@php100.netµÄ¼Ò»ïÃÇ£¬Õâ¸ö·½
·¨¿ÉÒԺܷ½±ãµÄץסËûÃÇ¡£
¡¡¡¡3.Èç¹ûÄãʹÓõÄÊÇPHP 5ºÍMySQL 4.1 »òÕ߸ü¸ßµÄ°æ±¾£¬¿¼ÂÇÓÃmysqli_* ϵÁк¯Êý¡£
¡¡¡¡Ò»¸öºÜºÃµÄ¹¦ÄܾÍÊÇÄã¿ÉÒÔʹÓÃÔ¤´¦ÀíÓï¾ä£¬Èç¹ûÄãÔÚά»¤Ò»¸öÊý¾Ý¿âÃܼ¯ÐÍÕ¾µã£¬Õâ¸ö¹¦ÄÜÄܹ»¼Ó¿ì²éѯËٶȡ£ ......
it is 21th of May. The Month of PHP Security
(http://www.php-security.org) is still running and we have reached a
vulnerability count of 40 vulnerabilities, which is nearly as much as we
disclosed during the whole Month of PHP Bugs in 2007. However there are
11 more days until the end of May and therefore there are still plenty
of more vulnerabilities to come. Escpecially the amount of SQL injection
vulnerabilites in PHP applications will increase, because it is called
SQL injection marathon for a reason. And we also have several articles
and submissions left.
There have been some changes to the website that should make it easier
to read and we also added the possiblity to comment on bugs/entries/news
and articles.
For those that don't already know you can follow the Month of PHP
Security on Twitter, too. Just follow @mops_2010
Here is the summary of what happened during the last 10 days.
Related Events
--------------
Returning into the PHP Interpreter – Remote E ......
php½Ì³Ì mysql½Ì³Ì_connect Óëmysql_pconnectº¯ÊýÓëʵÀý½Ì³Ì
mysql_connect
mysql_connect($this->root,$this->user,$this->pass)
/*
mysql_connect ,µ¥¸ö·´ÎÊÓû§²»»áƵ·±µÄµ÷ÓÃÊý¾Ý¿â½Ì³Ì£¬Ã»±ØÒª±£³ÖÁ¬½Ó£¬¶øÇÒmysqlµÄÁ¬½ÓÊýÒ²ÊÇÓÐÏÞÖƵģ¬ ʹÓà ¼°Ê±·ÃÎʱȽÏƵ·±£¬Ò²×îºÃʹÓÃmysql_connect£¬ÕâÑùʹÓõĹýµÄ×ÊÔ´¿ÉÒÔÁ¢¿ÌÊÍ·Å£¬·ñÔò£¬ÈÝÒ×Ôì³É×ÊÔ´ºÄ
*/
mysql_pconnect
/*
mysql_pconnect() º¯Êý´ò¿ªÒ»¸öµ½ MySQL ·þÎñÆ÷µÄ³Ö¾ÃÁ¬½Ó
*/
$con = mysql_pconnect("localhost","mysql_user","mysql_pwd");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
class testLinkMysql{
public $conn;
public $root='localhost';
public $user='root';//'loupan';
public $pass='root';//'loupandsffds';
public $db='dbname';
public $charset='gbk';
public $links='c'; //±êÌâ
function __construct() {
if( !$this->conn )
{
& ......
php½Ì³Ì mysql½Ì³Ì_connect Óëmysql_pconnectº¯ÊýÓëʵÀý½Ì³Ì
mysql_connect
mysql_connect($this->root,$this->user,$this->pass)
/*
mysql_connect ,µ¥¸ö·´ÎÊÓû§²»»áƵ·±µÄµ÷ÓÃÊý¾Ý¿â½Ì³Ì£¬Ã»±ØÒª±£³ÖÁ¬½Ó£¬¶øÇÒmysqlµÄÁ¬½ÓÊýÒ²ÊÇÓÐÏÞÖƵģ¬ ʹÓà ¼°Ê±·ÃÎʱȽÏƵ·±£¬Ò²×îºÃʹÓÃmysql_connect£¬ÕâÑùʹÓõĹýµÄ×ÊÔ´¿ÉÒÔÁ¢¿ÌÊÍ·Å£¬·ñÔò£¬ÈÝÒ×Ôì³É×ÊÔ´ºÄ
*/
mysql_pconnect
/*
mysql_pconnect() º¯Êý´ò¿ªÒ»¸öµ½ MySQL ·þÎñÆ÷µÄ³Ö¾ÃÁ¬½Ó
*/
$con = mysql_pconnect("localhost","mysql_user","mysql_pwd");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
class testLinkMysql{
public $conn;
public $root='localhost';
public $user='root';//'loupan';
public $pass='root';//'loupandsffds';
public $db='dbname';
public $charset='gbk';
public $links='c'; //±êÌâ
function __construct() {
if( !$this->conn )
{
& ......
<?
//²åÈëÅÅÐò£¨Ò»Î¬Êý×飩
function insert_sort($arr){
¡¡$count = count($arr);
¡¡for($i=1; $i<$count; $i++){
¡¡¡¡$tmp = $arr[$i];
¡¡¡¡$j = $i - 1;
¡¡¡¡while($arr[$j] > $tmp){
¡¡¡¡¡¡$arr[$j+1] = $arr[$j];
¡¡¡¡¡¡$arr[$j] = $tmp;
¡¡¡¡¡¡$j--;
¡¡¡¡}
¡¡}
¡¡return $arr;
}
¡¡¡¡
//Ñ¡ÔñÅÅÐò£¨Ò»Î¬Êý×飩
function select_sort($arr){
¡¡$count = count($arr);
¡¡for($i=0; $i<$count; $i++){
¡¡¡¡$k = $i;
¡¡¡¡for($j=$i+1; $j<$count; $j++){
¡¡¡¡¡¡if ($arr[$k] > $arr[$j])
¡¡¡¡¡¡¡¡$k = $j;
¡¡¡¡¡¡if ($k != $i){
¡¡¡¡¡¡¡¡$tmp = $arr[$i];
¡¡¡¡¡¡¡¡$arr[$i] = $arr[$k];
¡¡¡¡¡¡¡¡$arr[$k] = $tmp;
¡¡¡¡¡¡}
¡¡¡¡}
¡¡}
¡¡return $arr;
}
¡¡¡¡
//ðÅÝÅÅÐò£¨Ò»Î¬Êý×飩
function bubble_sort($array){
¡¡$count = count($array);
¡¡if ($count <= 0) return false;
¡¡
¡¡for($i=0; $i<$count; $i++){
¡¡¡¡for($j=$count-1; $j>$i; $j--){
¡¡¡¡¡¡if ($array[$j] < $array[$j-1]){
¡¡¡¡¡¡¡¡$tmp = $array[$j];
¡¡¡¡¡¡¡¡$array[$j] = $array[$j-1];
¡¡¡¡¡¡¡¡$array[$j-1] = $tmp;
¡¡¡¡¡ ......
dir() º¯Êý´ò¿ªÒ»¸öĿ¼¾ä±ú£¬²¢·µ»ØÒ»¸ö¶ÔÏó¡£Õâ¸ö¶ÔÏó°üº¬Èý¸ö·½·¨£ºread() , rewind() ÒÔ¼° close()¡£
Èô³É¹¦£¬Ôò¸Ãº¯Êý·µ»ØÒ»¸öĿ¼Á÷£¬·ñÔò·µ»Ø false ÒÔ¼°Ò»¸ö error¡£¿ÉÒÔͨ¹ýÔÚº¯ÊýÃûÇ°¼ÓÉÏ "@" À´Òþ²Ø error µÄÊä³ö¡£
<?php
//´ò¿ª images Ŀ¼
$dir = dir("images");
//Áгö images Ŀ¼ÖеÄÎļþ
while (($file = $dir->read()) !== false)
{
echo "filename: " . $file . "<br />";
}
$dir->close();
?> ......