php google baidu ·ÖÒ³
php google baidu ·ÖÒ³
<?php
/**
×÷Õߣº
äìÏæ²©¿Í http://blog.csdn.net/fkedwgwy
ʱ¼ä£º
2009-11-26
php¼¼ÊõȺ£º
37304662
ʹÓ÷½·¨£º
include_once'Pager.class.php';
$pager=new Pager();
if(isset($_GET['page']))
$pager->setCurrentPage($_GET['page']);
else
$pager->setCurrentPage(1);
$pager->setRecorbTotal(1000);
$pager->setBaseUri("page.php?");
echo $pager->execute();
**/
class Pager{
/**
*int×ÜÒ³Êý
**/
protected $pageTotal;
/**
*intÉÏÒ»Ò³
**/
protected $previous;
/**
*intÏÂÒ»Ò³
**/
protected $next;
/**
*intÖмäÒ³ÆðʼÐòºÅ
**/
protected $startPage;
/**
*intÖмäÒ³ÖÕÖ¹ÐòºÅ
**/
protected $endPage;
/**
*int¼Ç¼×ÜÊý
**/
protected $recorbTotal;
/**
*intÿҳÏÔʾ¼Ç¼Êý
**/
protected $pageSize;
/**
*intµ±Ç°ÏÔʾҳ
**/
protected $currentPage;
/**
*string»ùurlµØÖ·
**/
protected $baseUri;
/**
*@returnstring»ñÈ¡»ùurlµØÖ·
*/
public function getBaseUri(){
return$this->baseUri;
}
/**
*@returnint»ñÈ¡µ±Ç°ÏÔʾҳ
*/
public function getCurrentPage(){
return $this->currentPage;
}
/**
*@returnint»ñȡÿҳÏÔʾ¼Ç¼Êý
*/
public function getPageSize(){
return $this->pageSize;
}
/**
*@returnint»ñÈ¡¼Ç¼×ÜÊý
*/
public function getRecorbTotal(){
return$this->recorbTotal;
}
/**
*@paramstring$baseUriÉèÖûùurlµØÖ·
*/
public function setBaseUri($baseUri){
$this->baseUri=$baseUri;
}
/**
*@paramint$currentPageÉèÖõ±Ç°ÏÔʾҳ
*/
public function setCurrentPage($currentPage){
$this->currentPage=$currentPage;
}
/**
*@paramint$pageSizeÉèÖÃÿҳÏÔʾ¼Ç¼Êý
*/
public function setPageSize($pageSize){
$this->pageSize=$pageSize;
}
/**
*@paramint$recorbTotalÉèÖûñÈ¡¼Ç¼×ÜÊý
*/
public function setRecorbTotal($recorbTotal){
$this->recorbTotal=$recorbTotal;
}
/**
*¹¹Ô캯Êý
**/
public function __construct()
{
$this->pageTotal=0;
$this->previous=0;
$this->next=0;
$this->startPage=0;
$this->endPage=0;
$this->pageSize=20;
$this->currentPage=0;
}
/
Ïà¹ØÎĵµ£º
ÈçºÎ´´½¨ÎÒÃǵĵÚÒ»¸öPHPÒ³ÃæÄØ£¿·Ç³£¼òµ¥µÄ£¡Ñ¡ÔñÎÒÃÇʹÓõÄÒ»¸ö×îºÃµÄÉè¼Æ¹¤¾ß£¬µ±È»ÄãÒ²¿ÉÒÔ Ö»Ê¹ÓüÇʱ¾¡£´´½¨Ö®ºó¼ÇµÃÒª±£´æÎªÀ©Õ¹ÃûΪPHPµÄÎļþ£¬È»ºó´«µ½ÎÒÃǵķþÎñÆ÷
ÉÏ¡£
¡¡¡¡ÔÚ±àдPHP³ÌÐò֮ǰͨ³£ÎÒÃÇÐèÒªÅäÖÃÎÒÃǵĻ·¾³£¬Ò²¾ÍÊÇ˵·þÎñÆ÷
ÒªÖ§³ÖPHP²ÅÄÜÐа¡
¡¡¡¡Ò»¡¢PHPµÄ»ù±¾½á¹¹£º
¡¡¡¡Ê¹ÓÃIncl ......
linuxÏÂapache+php°²×°³£¼ûÎÊÌâ configure: error: Unable to find libgd.(a|so)
Èç¹ûʹÓõÄÊÇubuntu»òdebian¾ÍºÜ¼òµ¥ÁË£¬Ö±½Ósudo apt-get install apache2 libapache2-mod-php5 php5 php5-gd ¾Í»ù±¾Éϸ㶨£¬µ«ÊÇÓÃÔ´´úÂë°²×°»¹ÊǺÜÂé·³¡«
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
tar zxvf gd-2.0 ......
PHPÊǸöΰ´óµÄweb¿ª·¢ÓïÑÔ£¬Áé»îµÄÓïÑÔ£¬µ«ÊÇ¿´µ½php³ÌÐòÔ±Öܶø¸´Ê¼µÄ·¸µÄһЩ´íÎó¡£ÎÒ×öÁËÏÂÃæÕâ¸öÁÐ±í£¬ÁгöÁËPHP³ÌÐòÔ±¾³£·¸µÄ10ÖдíÎ󣬴ó¶àÊýºÍ°²È«Ïà¹Ø¡£¿´¿´Äã·¸Á˼¸ÖÖ
1.²»×ªÒâhtml entities
Ò»¸ö»ù±¾µÄ³£Ê¶£ºËùÓв»¿ÉÐÅÈεÄÊäÈë£¨ÌØ±ðÊÇÓû§´ÓformÖÐÌá½»µÄÊý¾Ý£© £¬Êä³ö֮ǰ¶¼Òª×ªÒâ¡£
echo $ ......
Óû§ÈÏÖ¤µÄÔÀíºÜ¼òµ¥£ºÊ×ÏÈÐèÒªÓû§ÔÚÒ³ÃæÉÏÌîÈëÓû§ÃûºÍÃÜÂ룬µ±È»Ã»×¢²áµÄÓû§ÐèÒªÏÈ×¢²á¡£È»ºóµ÷ÓÃÊý¾Ý¿âËÑË÷ÊÇ·ñÓÐÏàÓ¦µÄÓû§¡£Èç¹ûÓоÍÈ·ÈÏ£¬Ã»ÓÐÔòÌáÐÑÓû§ÏÈ×¢²á¡£Ê¹ÓÃPHPÀ´Íê³ÉÕâÒ»Çкܼòµ¥£¬µ«ÐèҪעÒâµÄÊÇÈç¹ûÏëÔÚÒÔºóµÄÒ³ÃæÖж¼ÄÜÈ·ÈÏÓû§Éí·Ý¡£
µÚÒ»²½ÊÇ×öÒ»¸öµÇ¼µÄÒ³Ãæ¡£
µÚ¶þ²½¿ªÊ¼µÇ¼ºóµÄÈ·ÈϳÌÐòµÄÉ ......
ƽʱÓà htmlspecialchars() À´¹ýÂËhtml, µ«ÊǰÑhtmlµÄ×Ö·ûתÒåÁË,×îºóÏÔʾ³öÀ´µÄ¾ÍÊÇhtmlÔ´´úÂë, ÀûÓÃstrip_tags()¾Í¿ÉÒÔ°Ñhtml±êǩȥ³ýµô.
[php]
$str = 'harryxu
‘;
echo(htmlspecialchars($str) . ‘
‘);
echo(strip_tags($str));
// output:
// harryxu
// harryxu
?>
......