二款php分页实例代码
<style type="text/css教程"> 二款php教程分页实例代码
a.pagecool,.pagecoolselect,.pagecoolpre,.pagecoolnext,.pageinfo,.curtotalx,.pagecoolprex,.pagecoolnextx{float:left;height:20px;font-family:arial,宋体;color:#444;font-weight:bold}
a.pagecool,.pagecoolselect{width:22px;height:18px;font-weight:bold;border:#ccc 1px solid;margin:0 3px 0 3px;text-align:center;line-height:18px}
a.pagecool{text-decoration:none;color:#444;background:#fbf9f9;display:block}
a.pagecool:hover,.pagecoolselect{color:#f00;background:#ffc}
.pagecoolpre,.pagecoolnext{margin:0 8px 0 8px}
.pageinfo{line-height:20px;margin:0 0 0 8px;font-family:verdana,arial}
.pageinfo span{color:#f60}
.pagecoolprex,.pagecoolnextx{margin:0 0 0 5px}
.curtotalx{color:#666;line-height:20px;margin:0 2px 0 0;font-weight:normal;font-family:verdana,arial;text-align:right}
</style>
<?php
!function_exists('cdstr') && exit('forbidden');
class wrzc_netpage {
private $page_name="p";
private $pagesize=10;//每页显示记录条数
private $total=0;//总的记录数
private $pagebarnum=10;//bar数。
private $totalpage=0;
private $linkhead="";//url地址头
private $current_pageno=1;//当前页
public function __construct($total,$pagesize=10) {
if((!is_int($total))||($total<0))die("记录总数错误!");
if((!is_int($pagesize))||($pagesize<0))die("pagesize错误!");
$this->set("total",$total);
$this->set("pagesize",$pagesize);
$this->set('totalpage',ceil($total/$pagesize));
}
public function set($var,$value){
if(in_array($var,get_object_vars($this)))
$this->$var=$value;
else {
throw new pb_page_exception("error in set():".$var." does not belong to pb_page!");
}
}
public function get_linkhead() {
$this->set_current_page();
if(empty($_server['query_string'])){
$this->linkhead=$_server['request_uri']."?".$this->page_name."=";
}else{
if(isset($_get[$this->page_name])){
$this->linkhead=str_replace($this->page_name.'='.$this->current_pageno,$this->page_name.'=',$_server['request_uri']);
} else {
$this->linkhead=$_server['request_uri'].'&'.$this->page_name.'=';
}
}
}
/*为指定的页面返回地址值*/
public function get_url($pageno=1){
if(empty($this->linkhead))$this->get_linkhead();
return str_replace($this->page_name.'=',$this->page_name.'='.$pageno,$this->linkhead);
}
/*当前页*/
public function set_current_page($current_pageno=0) {
if(empty($current_pageno)){
if(isset($_get[$this->page_name])){$this->current_pageno=intval($_get[$this->page_name]);}
}else{
$this->current_pageno=intval($current_pageno);
}
if ($this->current_pageno>$this->totalpage) header("location:./");//$this->current_pageno=1
}
public function set_format($str) {return $this->format_left.$str.$this->format_right;}
/* 获取显示"下一页"*/
public function next_page() {
if($this->current_pageno<$this->totalpage){
return '<a href="'.$this->get_url($this->current_pageno+1).'">'.$this->next_page.'</a>';
}
return '';
}
/*获取显示“上一页”*/
public function pre_page() {
if($this->current_pageno>1){return '<a href="'.$this->get_url($this->current_pageno-1).'">'.$this->pre_page.'</a>';}
return '';
}
/*获取显示“首页”*/
public function first_page() {return '<a href="'.$this->get_url(1).'">'.$this->first_page."</a>";}
/*获取显示“尾页”*/
public function last_page() {return '<a href="'.$this->get_url($this->totalpage).'">'.$this->last_page.'</a>';}
public function nowbar() {
if ($this->totalpage > 1){
$begin=$this->current_pageno-ceil($this->pagebarnum/2);
$begin=($begin>=1)?$begin:1;
$return='';
for($i=$begin;$i<$begin+$this->pagebarnum;$i++){
if($i<=$this->totalpage){
if($i!=$this->current_pageno){
$return.="<a href=".$this->get_url($i)." class=pagecool>".$i.'</a>';
}else {
$return.='<div class=pagecoolselect>'.$i.'</div>';
}
}else{
break;
}
}
unset($begin);
}
return $return;
}
/*“上一页”*/
public function pre_bar() {
if($this->current_pageno>ceil($this->pagebarnum/2)){
$pageno=$this->current_pageno-$this->pagebarnum;
if($pageno<=0)$pageno=1;
return $this->set_format('<a href="'.$this->get_url($pageno).'">'.$this->pre_bar."</a>");
}
return $this->set_format('<a href="'.$this->get_url(1).'">'.$this->pre_bar."</a>");
}
/*“下一页”*/
public function next_bar() {
if($this->current_pageno<$this->totalpage-ceil($this->pagebarnum/2)){
$pageno=$this->current_pageno+$this->pagebarnum;
return $this->set_format('<a href="'.$this->get_url($pageno).'">'.$this->next_bar."</a>");
}
return $this->set_format('<a href="'.$this->get_url($this->totalpage).'">'.$this->next_bar."</a>");
}
/*跳转*/
public function select() {
$return='<select name="pb_page_select" onchange="window.location.href=''.$this->linkhead.''+this.options[this.selectedindex].value">';
for($i=1;$i<=$this->totalpage;$i++){
if($i==$this->current_pageno){
$return.='<option value="'.$i.'" selected>'.$i.'</option>';
}else{
$return.='<option value="'.$i.'">'.$i.'</option>';
}
}
$return.='</select>';
return $return;
}
public function pagebar($mode=1){
global $global;
$this->set_current_page();
$this->get_linkhead();
//return ("共有<font color=red><b>".$this->total."</b></font>条记录。");
switch ($mode) {
case 1:
$this->pre_page='<img src='.$global['www_2domain'].'/images/precool.gif title=上一页 class=pagecoolpre>';
$this->next_page='<img src='.$global['www_2domain'].'/images/nextcool.gif title=下一页 class=pagecoolnext>';
return $this->pre_page().$this->nowbar().$this->next_page().'<div class=pageinfo>第<span>'.$this->current_pageno.'</span>页 / 共<span>'.$this->totalpage.'</span>页</div>';
break;
case 2:
$this->pre_page='<img src='.$global['www_2domain'].'/images/precoolx.gif title=上一页 class=pagecoolprex>';
$this->next_page='<img src='.$global['www_2domain'].'/images/nextcool.gif title=下一页 class=pagecoolnextx>';
return '<div class=curtotalx>'.$this->current_pageno.'/'.$this->totalpage.'</div>'.$this->pre_page().$this->next_page();
//return '<div class=curtotalx>'.$this->total.'/'.$this->current_pageno.'/'.$this->totalpage.'</div>'.$this->pre_page().$this->next_page();
break;
case 3:
$this->pre_page='<img src='.$global['www_2domain'].'/images/precoolx.gif title=上一页 class=pagecoolprex>';
$this->next_page='<img src='.$global['www_2domain'].'/images/nextcool.gif title=下一页 class=pagecoolnextx>';
return '<div class=curtotalx>第'.$this->current_pageno.'页/共'.$this->totalpage.'页</div>'.$this->pre_page().$this->next_page();
break;
}
}
}
?>
代码二
<?php
!function_exists('cdstr') && exit('forbidden');
class uobarpage {
private $page_name="p";//page标签,用来控制url页。比如说xxx.php?pb_page=2中的pb_page
private $pagesize=10;//每页显示记录条数
private $total=0;//总的记录数
private $pagebarnum=10;//控制记录条的个数。
private $totalpage=0;//总页数
private $linkhead="";//url地址头
private $current_pageno=1;//当前页
/**
* 显示符号设置
*/
private $next_page='>';//下一页
private $pre_page='<';//上一页
private $first_page='first';//首页
private $last_page='last';//尾页
private $pre_bar='<<';//上一分页条
private $next_bar='>>';//下一分页条
private $format_left=' [';
private $format_right='] ';
public function __construct($total,$pagesize=10) {
if((!is_int($total))||($total<0))die("记录总数错误!");
if((!is_int($pagesize))||($pagesize<0))die("pagesize错误!");
$this->set("total",$total);
$this->set("pagesize",$pagesize);
$this->set('totalpage',ceil($total/$pagesize));
}
public function set($var,$value)
{
if(in_array($var,get_object_vars($this)))
$this->$var=$value;
else {
throw new pb_page_exception("error in set():".$var." does not belong to pb_page!");
}
}
/**
* get the default url获取指定的url地址
*
*/
/*
public function get_linkhead() {
$this->set_current_page();
$this->linkhead=$_server['php_self']."?".$this->page_name."=";
}
*/
public function get_linkhead() {
$this->set_current_page();
if(empty($_server['query_string'])){
$this->linkhead=$_server['request_uri']."?".$this->page_name."=";
}else{
if(isset($_get[$this->page_name])){
$this->linkhead=str_replace($this->page_name.'='.$this->current_pageno,$this->page_name.'=',$_server['request_uri']);
} else {
$this->linkhead=$_server['request_uri'].'&'.$this->page_name.'=';
}
}
}/**
* 为指定的页面返回地址值
*/
public function get_url($pageno=1)
{
if(empty($this->linkhead))$this->get_linkhead();
return str_replace($this->page_name.'=',$this->page_name.'='.$pageno,$this->linkhead);
}
/**
* 设置当前页面
*
*/
public function set_current_page($current_pageno=0) {
if(empty($current_pageno)){
if(isset($_get[$this->page_name])){
$this->current_pageno=intval($_get[$this->page_name]);
}
}else{
$this->current_pageno=intval($current_pageno);
}
if ($this->current_pageno>$this->totalpage) header("location:./");//////////$this->current_pageno=1////////////
}
public function set_format($str) {
return $this->format_left.$str.$this->format_right;
}/**
* 获取显示"下一页"的代码
*
* @return string
*/
public function next_page() {
if($this->current_pageno<$this->totalpage){
return ' <a href="'.$this->get_url($this->current_pageno+1).'">'.$this->next_page.'</a> ';
}
return '';
}
/**
* 获取显示“上一页”的代码
*
* @return string
*/
public function pre_page() {
if($this->current_pageno>1){
return '<a href="'.$this->get_url($this->current_pageno-1).'">'.$this->pre_page.'</a> ';
}
return '';
}
/**
* 获取显示“首页”的代码
*
* @return string
*/
public function first_page() {
return '<a href="'.$this->get_url(1).'">'.$this->first_page."</a>";
}
/**
* 获取显示“尾页”的代码
*
* @return string
*/
public function last_page() {
return '<a href="'.$this->get_url($this->totalpage).'">'.$this->last_page.'</a>';
}
//gyl1
public function nowbar() {
$begin=$this->current_pageno-ceil($this->pagebarnum/2);
$begin=($begin>=1)?$begin:1;
$return='';
for($i=$begin;$i<$begin+$this->pagebarnum;$i++)
{
if($i<=$this->totalpage){
if($i!=$this->current_pageno)
$return.=' <a href="'.$this->get_url($i).'">'.'<span class=page1 onmouseo教程ver=this.style.background="ffffcc" onmouseout=this.style.background="fbf9f9"><b>'.$i.'</b></span>'.'</a> ';
else
$return.='<span class=page2><b>'.$i.'</b></span>';
}else{
break;
}
}
unset($begin);
return $return;
}
/**
* 获取显示“上一分页条”的代码
*
* @return string
*/
public function pre_bar()
{
if($this->current_pageno>ceil($this->pagebarnum/2)){
$pageno=$this->current_pageno-$this->pagebarnum;
if($pageno<=0)$pageno=1;
return $this->set_format('<a href="'.$this->get_url($pageno).'">'.$this->pre_bar."</a>");
}
return $this->set_format('<a href="'.$this->get_url(1).'">'.$this->pre_bar."</a>");
}
/**
* 获取显示“下一分页条”的代码
*
* @return string
*/
public function next_bar()
{
if($this->current_pageno<$this->totalpage-ceil($this->pagebarnum/2)){
$pageno=$this->current_pageno+$this->pagebarnum;
return $this->set_format('<a href="'.$this->get_url($pageno).'">'.$this->next_bar."</a>");
}
return $this->set_format('<a href="'.$this->get_url($this->totalpage).'">'.$this->next_bar."</a>");
}
/**
* 获取显示跳转按钮的代码
*
* @return string
*/
public function select()
{
$return='<select name="pb_page_select" onchange="window.location.href=''.$this->linkhead.''+this.options[this.selectedindex].value">';
for($i=1;$i<=$this->totalpage;$i++)
{
if($i==$this->current_pageno){
$return.='<option value="'.$i.'" selected>'.$i.'</option>';
}else{
$return.='<option value="'.$i.'">'.$i.'</option>';
}
}
$return.='</select>';
return $return;
}
/**
* 获取mysql教程 语句中limit需要的值
*
* @return string
*/
public function limit2(){
//return ("共有<font color=red><b>".$this->total."</b></font>条记录。");
//return ('共有<font color=red>'.$this->total.'</font>条记录。第<font color=red>'.$this->current_pageno)."</font>页/共<font color=red>".$this->totalpage.'</font>页';
return ('<span style="height:20px;padding-top:3px;">共<b>'.$this->current_pageno.' / '.$this->totalpage.'</b>页</span>');
}
public function pagebar($mode=1)
{ global $global;
$this->set_current_page();
$this->get_linkhead();
switch ($mode)
{
case '1':
$this->next_page='<img src='.$global['www_2domain'].'/images/next.gif border=0 align=absmiddle alt=下一页>';
$this->pre_page='<img src='.$global['www_2domain'].'/images/pre.gif border=0 align=absmiddle alt=上一页>';
return $this->pre_page().$this->nowbar().$this->next_page();
//return $this->pre_page().$this->nowbar().$this->next_page().'第'.$this->select().'页';
break;
}
}
}
?>
php教程常用ip转换与文件下载代码
ip转换
php中将ip转换成整型的函数ip2long()容易出现问题,在ip比较大的情况下,会变成负数。
<?php
$ip = "192.168.1.2";
$ip_n = ip2long($ip);
echo $ip_n; //得到 -1062731518
?>
由于ip转换成的整型值太大超出了整型的范围,所以变成负数。需写成$ip_n = bindec(decbin(ip2long($ip)));这样便可得到无符号的整型数,如下
<?php
$ip = "192.168.1.2";
$ip_n = bindec(decbin(ip2long($ip)));
echo $ip_n; //得到 3232235778
?>
文件下载代码
<?php
header("content-type: application/force-download");
header("content-disposition: attachment; filename=ins.jpg");
readfile("imgs/test_zoom.jpg");
?>
第一行代码是强制下载;
第二行代码是给下载的内容指定一个名字;
第三行代码是把下载的内容读进文件中。
example #1 forcing a download using readfile()
<?php
$file = 'monkey.gif';if (file_exists($file)) {
header('content-description: file transfer');
header('content-type: application/octet-stream');
header('content-disposition: attachment; filename='.basename($file));
header('content-transfer-encoding: binary');
header('expires: 0');
header('cache-control: must-revalidate, post-check=0, pre-check=0');
header('pragma: public');
header('content-length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
function getip() {
if(getenv('http_client_ip') && strcasecmp(getenv('http_client_ip'), 'unknown')) {
$onlineip = getenv('http_client_ip');
} elseif(getenv('http_x_forwarded_for') && strcasecmp(getenv('http_x_forwarded_for'), 'unknown')) {
$onlineip = getenv('http_x_forwarded_for');
} elseif(getenv('remote_addr') && strcasecmp(getenv('remote_addr'), 'unknown')) {
$onlineip = getenv('remote_addr');
} elseif(isset($_server['remote_addr']) && $_server['remote_addr'] && strcasecmp($_server['remote_addr'], 'unknown')) {
$onlineip = $_server['remote_addr'];
}
$onlineip = preg_replace("/^([d.]+).*/", "1", $onlineip);
return $onlineip;
}
function htmlout($str){
$guest=$str;
$guest=str_replace("&","&",$guest);
$guest=str_replace(" "," ",$guest);
//$guest=str_replace(" "," ",$guest);
$guest=str_replace(" "," ",$guest);
//$guest=htmlspecialchars($guest);
$guest=str_replace(">",">",$guest);
$guest=str_replace("<","<",$guest);
$guest=str_replace("rn","<br>",$guest);
$guest=str_replace("'","'",$guest);
$guest=str_replace(""",""",$guest);
return($guest);
}
function badstr ($str,$to='*') {
global $global;
$from = $str;
$rg_banname=$global['m_badwords'];
$rg_banname=explode(',',$rg_banname);
foreach($rg_banname as $value){
if(strpos($str,$value)!==false){
//$from = strtr($str,$value,$to);
$from = str_replace($value,$to,$from);
}
}
return($from);
}
function mkpath($mkpath,$mode=0777){
$path_arr=explode('/',$mkpath);
foreach ($path_arr as $value){
if(!empty($value)){
if(empty($path))$path=$value;
else $path.='/'.$value;
is_dir($path) or mkdir($path,$mode) or chmod($path,$mode);
}
}
if(is_dir($mkpath))return true;
return false;
}
function daddslashes($string, $force = 0) {
global $magic_quotes_gpc;
if(!$globals['magic_quotes_gpc'] || $force || $magic_quotes_gpc) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = daddslashes($val, $force);
}
} else {
$string = addslashes($string);
}
}
return $string;
}
function dhtmlspecialchars($string) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = dhtmlspecialchars($val);
}
} else {
$string = preg_replace('/&((#(d{3,5}|x[a-fa-f0-9]{4})|[a-za-z][a-z0-9]{2,5});)/', '&1',
str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $string));
}
return $string;
}
function trimm ($str) {
$str = trim(str_replace(" "," ",$str));
//$str = str_replace("'","‘",$str);
return $str;
}
function cdstr($length) {
$possible = "0123456789";
$str = "";
while(strlen($str) < $length) $str .= substr($possible, (rand() % strlen($possible)), 1);
return($str);
}
function cdstrletters($length) {
$possible = "abcdefghijklmnopqrstuvwxyz";
$str = "";
while(strlen($str) < $length) $str .= substr($possible, (rand() % strlen($possible)), 1);
return($str);
}
function cdnumletters($length) {
$possible = "0123456789abcdefghijklmnopqrstuvwxyz";
$str = "";
while(strlen($str) < $length) $str .= substr($possible, (rand() % strlen($possible)), 1);
return($str);
}
// date_format2($rs['time'],'%y年%m月%d日%h时%m分%s秒');
function date_format2($string, $format='%b %e, %y', $default_date=null)
{
if (substr(php教程_os,0,3) == 'win') {
$_win_from = array ('%e', '%t', '%d');
$_win_to = array ('%#d', '%h:%m:%s', '%m/%d/%y');
$format = str_replace($_win_from, $_win_to, $format);
}
if($string != '') {
return strftime($format, smarty_make_timestamp($string));
} elseif (isset($default_date) && $default_date != '') {
return strftime($format, smarty_make_timestamp($default_date));
} else {
return;
}
}
function smarty_make_timestamp($string){
if(empty($string)) {
$string = "now";
}
$time = strtotime($string);
if (is_numeric($time) && $time != -1)
return $time;
if (preg_match('/^d{14}$/', $string)) {
$time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2),
substr($string,4,2),substr($string,6,2),substr($string,0,4));
return $time;
}
$time = (int) $string;
if ($time > 0)
return $time;
else
return time();
}
header() 函数向客户端发送原始的 http 报头。
认识到一点很重要,即必须在任何实际的输出被发送之前调用 header() 函数(在 php教程 4 以及更高的版本中,您可以使用输出缓存来解决此问题):
<html>
<?php
// 结果出错
// 在调用 header() 之前已存在输出
header('location: http://www.111cn.net/');
?>语法
header(string,replace,http_response_code)参数 描述
string 必需。规定要发送的报头字符串。
replace 可选。指示该报头是否替换之前的报头,或添加第二个报头。
默认是 true(替换)。false(允许相同类型的多个报头)。
http_response_code 可选。把 http 响应代码强制为指定的值。(php 4 以及更高版本可用)
<?php
function downfile()
{$filename=realpath("resume.html");
header( "content-type: application/octet-stream ");
header( "accept-ranges: bytes ");
header( "accept-length: " .filesize($filename));
header( "content-disposition: attachment; filename= 4.html");
echo file_get_contents($filename);
readfile($filename);
}
downfile();?>
<?php
function downfile($fileurl)
{
$filename=$fileurl;
$file = fopen($filename, "rb");
header( "content-type: application/octet-stream ");
header( "accept-ranges: bytes ");
header( "content-disposition: attachment; filename= 4.doc");
$contents = "";
while (!feof($file)) {
$contents .= fread($file, 8192);
}
echo $contents;
fclose($file);}
$url=$_request['url'];
$url="http://www.111cn.net";
downfile($url);?>
相关文章
- 我们这里介绍php与KindEditor编辑器使用时如何利用KindEditor编辑器的分页功能实现文章内容分页,KindEditor编辑器在我们点击分页时会插入代码,我们只要以它为分切符,就...2016-11-25
- 最近接了一个项目,其中有需求要用到jquery分页控件,上网也找到了需要分页控件,各种写法各种用法,都是很复杂,最终决定自己动手写一个jquery分页控件,全当是练练手了。写的不好,还请见谅,本分页控件在chrome测试过,其他的兼容性...2015-10-30
- 有一种方法,可以不打开网站而直接查看到这个网站的源代码.. 这样可以有效地防止误入恶意网站... 在浏览器地址栏输入: view-source:http://...2016-09-20
- <?php require('path.inc.php'); header('content-Type: text/html; charset=utf-8'); $borough_id = intval($_GET['id']); if(!$borough_id){ echo ' ...2016-11-25
- 本文实例讲述了JS基于Mootools实现的个性菜单效果代码。分享给大家供大家参考,具体如下:这里演示基于Mootools做的带动画的垂直型菜单,是一个初学者写的,用来学习Mootools的使用有帮助,下载时请注意要将外部引用的mootools...2015-10-23
- 本文实例讲述了JS+CSS实现分类动态选择及移动功能效果代码。分享给大家供大家参考,具体如下:这是一个类似选项卡功能的选择插件,与普通的TAb区别是加入了动画效果,多用于商品类网站,用作商品分类功能,不过其它网站也可以用,...2015-10-21
- 本文实例讲述了JS实现自定义简单网页软键盘效果。分享给大家供大家参考,具体如下:这是一款自定义的简单点的网页软键盘,没有使用任何控件,仅是为了练习JavaScript编写水平,安全性方面没有过多考虑,有顾虑的可以不用,目的是学...2015-11-08
- 本文实例讲述了jquery实现的伪分页效果代码。分享给大家供大家参考,具体如下:这里介绍的jquery伪分页效果,在火狐下表现完美,IE全系列下有些问题,引入了jQuery1.7.2插件,代码里有丰富的注释,相信对学习jQuery有不小的帮助,期...2015-10-30
- php 取除连续空格与换行代码,这些我们都用到str_replace与正则函数 第一种: $content=str_replace("n","",$content); echo $content; 第二种: $content=preg_replac...2016-11-25
- php简单用户登陆程序代码 这些教程很对初学者来讲是很有用的哦,这款就下面这一点点代码了哦。 <center> <p> </p> <p> </p> <form name="form1...2016-11-25
- 公司一些wordpress网站由于下载的插件存在恶意代码,导致整个服务器所有网站PHP文件都存在恶意代码,就写了个简单的脚本清除。恶意代码示例...2015-10-23
- 本文实例讲述了JS实现双击屏幕滚动效果代码。分享给大家供大家参考,具体如下:这里演示双击滚屏效果代码的实现方法,不知道有觉得有用处的没,现在网上还有很多还在用这个特效的呢,代码分享给大家吧。运行效果截图如下:在线演...2015-10-30
- 其实挺简单的就是if(navigator.userAgent.indexOf('UCBrowser') > -1) {alert("uc浏览器");}else{//不是uc浏览器执行的操作}如果想测试某个浏览器的特征可以通过如下方法获取JS获取浏览器信息 浏览器代码名称:navigator...2015-11-08
- 一、日期减去天数等于第二个日期function cc(dd,dadd){//可以加上错误处理var a = new Date(dd)a = a.valueOf()a = a - dadd * 24 * 60 * 60 * 1000a = new Date(a)alert(a.getFullYear() + "年" + (a.getMonth() +...2015-11-08
- 微信支付,即便交了保证金,你还是处理测试阶段,不能正式发布。必须到你通过程序测试提交订单、发货通知等数据到微信的系统中,才能申请发布。然后,因为在微信中是通过JS方式调用API,必须在微信后台设置支付授权目录,而且要到...2014-05-31
- Vue.js通过简洁的API提供高效的数据绑定和灵活的组件系统.这篇文章主要介绍了vue.js 表格分页ajax 异步加载数据的相关资料,需要的朋友可以参考下...2016-10-20
- 本文实例讲述了PHP常用的小程序代码段。分享给大家供大家参考,具体如下:1.计算两个时间的相差几天$startdate=strtotime("2009-12-09");$enddate=strtotime("2009-12-05");上面的php时间日期函数strtotime已经把字符串...2015-11-24
- 小编分享了一段简单的php中文转拼音的实现代码,代码简单易懂,适合初学php的同学参考学习。 代码如下 复制代码 <?phpfunction Pinyin($_String...2017-07-06
php导出csv格式数据并将数字转换成文本的思路以及代码分享
php导出csv格式数据实现:先定义一个字符串 存储内容,例如 $exportdata = '规则111,规则222,审222,规222,服2222,规则1,规则2,规则3,匹配字符,设置时间,有效期'."/n";然后对需要保存csv的数组进行foreach循环,例如复制代...2014-06-07- ecshop商品无限级分类代码 function cat_options($spec_cat_id, $arr) { static $cat_options = array(); if (isset($cat_options[$spec_cat_id]))...2016-11-25