discuzµÄPHP·ÖÒ³º¯Êý
function multi($num, $perpage, $curpage, $mpurl) {
$multipage = '';
$mpurl .= strpos($mpurl, '?') ? '&' : '?';
if($num > $perpage) {
$page = 10;
$offset = 5;
$pages = @ceil($num / $perpage);
if($page > $pages) {
$from = 1;
$to = $pages;
} else {
$from = $curpage - $offset;
$to = $curpage + $page - $offset - 1;
if($from < 1) {
$to = $curpage + 1 - $from;
$from = 1;
if(($to - $from) < $page && ($to - $from) < $pages) {
$to = $page;
}
} elseif($to > $pages) {
$from = $curpage - $pages + $to;
$to = $pages;
if(($to - $from) < $page && ($to - $from) < $pages) {
$from = $pages - $page + 1;
}
}
}
$multipage = ($curpage - $offset > 1 && $pages > $page ? '<a href="'.$mpurl.'page=1" mce_href="'.$mpurl.'page=1">µÚÒ»Ò³</a> ' : '').($curpage > 1 ? '<a href="'.$mpurl.'page='.($curpage - 1).'" mce_href="'.$mpurl.'page='.($curpage - 1).'">ÉÏÒ»Ò³</a> ' : '');
for($i = $from; $i <= $to; $i++) {
$multipage .= $i == $curpage ? $i.' ' : '<a href="'.$mpurl.'page='.$i.'" mce_href="'.$mpurl.'page='.$i.'">['.$i.']</a> ';
}
$multipage .= ($curpage < $pages ? '<a href="'.$mpurl.'page='.($curpage + 1).'" mce_href="'.$mpurl.'page='.($curpage + 1).'">ÏÂÒ»Ò³<
Ïà¹ØÎĵµ£º
ºÇºÇ£¬·ÒëÁËƪ¶«Î÷£¬N³¤Ê±¼äûÓÃÓ¢ÓïÁË£¬³öÁ˳ó´ó¼Ò¿ÉÒ»¶¨ÒªÖ¸³öÀ´°¡¡£·Òë×Ô£ºNick Halstead's Blog
A friend recently got some pre-interview questions from YAHOO for a PHP
job. Following up my previous post about programmer questions I
thought I would post them to give people examples of what a ......
PHPÃæÏò¶ÔÏó·ÖÎöÉè¼ÆµÄ61Ìõ¾ü¹æ
Äã²»±ØÑϸñ×ñÊØÕâЩÔÔò£¬Î¥±³ËüÃÇÒ²²»»á±»´¦ÒÔ×Ú½ÌÐÌ·£¡£µ«ÄãÓ¦µ±°ÑÕâЩÔÔò¿´³É¾¯Á壬ÈôÎ¥±³ÁËÆäÖеÄÒ»Ìõ£¬ÄÇô¾¯Áå¾Í»áÏìÆð ¡£ ----- Arthur J.Riel
(1)ËùÓÐÊý¾Ý¶¼Ó¦¸ÃÒþ²ØÔÚËùÔÚµÄÀàµÄÄÚ²¿¡£
(2)ÀàµÄʹÓÃÕß±ØÐëÒÀÀµÀàµÄ¹²Óнӿڣ¬µ«À಻ÄÜÒÀÀµËüµÄʹÓÃÕß¡£
(3)¾¡Á¿¼õÉÙÀàµÄÐÒéÖÐ ......
ÓÃPHPʵÏÖ¼òµ¥µÄÊý¾Ýץȡ
·½·¨Ò»£º
<?php
$urlstr = file_get_contents("http://www.baidu.com");
$urlstr = htmlspecialchars($urlstr);
print_r($urlstr);
?>
·½·¨¶þ£º£¨ÐèÒª´ò¿ªcurlÀ©Õ¹£©
×¢Ò⣺´ò¿ªcurlÀ©Õ¹Ê±£¬Ò»¶¨Òª¿´¿ ......
ÔÚPHPÖУ¬Èëջͨ¹ýarray_pushº¯ÊýʵÏÖ£¬Óï·¨ÈçÏ£º
int array_push(array,var [,var …])
varΪҪѹÈëÊý×éµÄÔªËØ£¬arrayΪÊý×é¡£º¯Êý·µ»ØÊý×éеÄÔªËØ×ÜÊý¡£
ÀýÈ磺
<?php
$php = array("php","phpdo","phpѧϰ");
print_r($php);
array_push($php, ......
ÓÉÓÚ×î½üÔÚÓëSPºÏ×÷,¿ª·¢ÊÖ»úÒµÎñÏÂÔØ,Êý¾ÝÌá½»²ÉÓÃPOST·½Ê½Ìá½»,ÏÖÓë´ó¼Ò·Öºà±È½Ï³ÉÊìÀà.
function uc_api_post($url, $action, $sendmsg='') {
$postdata = "corpMsg=$sendmsg";
return uc_fopen(UC_URL, 500000, $postdata, '', TRUE, UC_IP, 20);
}
function uc_fopen($url, $limit = 0, $post = '', $cookie = ......