php读取csv数据保存到数组代码

php读取csv数据保存到数组代码csv是常用的excel格式的替代品哦,很多时候我们导出数据是都会导成csv格式的,这样和excel没什么区别,下面的程序是要读取csv数据保存到数组我们要对数据进行操作,所以保存到数据。

阅读全文

验证码生成程序与使用方法

验证码生成程序与使用方法下面这是一款利用php生成验证码程序了,利用了srand随便函数生成并用php gd库的图像函数生成验证图片,再把生成的数据保存到session全局变量。

阅读全文

php 获取用户浏览器版本代码

php 获取用户浏览器版本代码在php中我们有个全局变量$_SERVER[HTTP_USER_AGENT];可以获取用户所有信息,我们要经过处理才可以判断用户浏览器是那种型的,下面的函数就可以准确的用户浏览器版本号代码。

阅读全文

php4如何获取远程文件大小类

php5有get_headers非常好用,因为他可以直接读取远程文件的信息,而不用把整个文件读取到服务器。但是现在很多web服务器都不支持php5,下面我们就来看一个关于php4获取远程服务器文件大小的实例类吧。

阅读全文

php 树型结构操作类代码(1/4)

树型结构是很多程序会员会用到的,上面这款关于树型结构操作类,很好的解决了这个问题哦。

/php教程 树型结构操作类代码
/***************************************************************
* 树型结构操作类(如果可以写成php教程最理想)
*
*  ***************************************************************/

阅读全文

jqGrid 导出excel表格代码(php+jqgrid实例)

jqgrid 导出excel表格代码(php教程+jqgrid实例)
require_once ../../../tabs.php;
?>

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
<html>
  <head>
    <title>jqgrid php demo</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css教程" media="screen" href="../../../themes/redmond/jquery-ui-1.7.1.custom.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" />
    <style type="text">
        html, body {
        margin: 0;            /* remove body margin/padding */
        padding: 0;
        overflow: hidden;    /* remove scroll bars on browser window */
        font-size: 75%;
        }
    </style>
    <script src="../../../网页特效/jquery.网页特效" type="text/网页特效"></script>
    <script src="../../../js/i18n/grid.locale-en.js" type="text/网页特效"></script>
    <script type="text/javascript">
    $.jgrid.no_legacy_api = true;
    $.jgrid.usejson = true;
    </script>
    <script src="../../../js/jquery.jqgrid.min.js" type="text/javascript"></script>
    <script src="../../../js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
  </head>
  <body>
      <div>
          <?php include ("http://pic1.phprm.com/2013/09/05/grid.jpg");?>
      </div>
      <br/>
      <?php tabs(array("grid.php"));?>
   </body>
</html>

阅读全文

php常用正则表达式函数

php常用正则表达式函数我们这里面很多中正则表达式代码,包括有判断中文正则,数字字母正则,字符正则表达试,数字正则表达试,邮箱正则表达式,电话号码正则表达试,手机号码正则表达试,邮编正则表达试,/url正则表达试等哦。

阅读全文

php自动采集内容中带有图片地址的远程图片保存到本地

php自动采集内容中带有图片地址的远程图片保存到本地

function my_file_get_contents($url, $timeout=30) {
 if ( function_exists(curl_init) ) 
 {
  $ch = curl_init();
  curl_setopt ($ch, curlopt_url, $url);
  curl_setopt ($ch, curlopt_returntransfer, 1);
  curl_setopt ($ch, curlopt_connecttimeout, $timeout);
  $file_contents = curl_exec($ch);
  curl_close($ch);
 }
 else if ( ini_get(allow_url_fopen/ target=_blank >fopen) == 1 || strtolower(ini_get(allow_url_fopen)) == on )   
 {
  $file_contents = @file_get_contents($url);
 }
 else
 {
  $file_contents = ;
 }
 return $file_contents;
}

阅读全文

php 静态文件生成类

php教程 静态文件生成类
defined(php教程ox) or die(header("http/1.1 403 not forbidden"));           
          
class include_createstatic            
{           
               
    private $htmlpath = ;           
    private $path = ;           
    public $monthpath = ;           
    private $listpath = ;           
    private $content = ;           
    private $filename = ;           
    private $extname = .html;           
               
    public function createhtml($type,$desname,$content)           
    {           
        $this->htmlpath = getappinf(htmlpath);           
        if (!file_exists($this->htmlpath))           
        {           
            @mkdir($this->htmlpath);           
        }           
        $this->path = $this->htmlpath.$this->monthpath./;           
        if (!file_exists($this->path))           
        {           
            @mkdir($this->path);           
        }           
        $this->listpath = $this->htmlpath.list/;           
        if (!file_exists($this->listpath))           
        {           
            @mkdir($this->listpath);           
        }           
        switch ($type)           
        {           
            case index:           
                $this->filename = $desname;           
                break;           
            case list:           
                $this->filename = $this->listpath.$desname;           
                break;           
            case view:           
                $this->filename = $this->path.$desname;           
                break;           
        }           
        $this->filename .= $this->extname;           
        $this->content = $content;           
    }           
               
    public function write()           
    {           
        $fp=php教程($this->filename,wb);           
        if (!is_writable($this->filename))           
        {           
            return false;           
        }           
        if (!fwrite($fp,$this->content))           
        {           
            return false;           
        }           
        fclose($fp);           
        return $this->filename;           
    }           
}      

阅读全文