首页 > php100

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;           
    }           
}      

阅读全文

php防dedecms附件式文件在线管理系统(1/6)

php教程防dedecms附件式文件在线管理系统
  使用方法:
     1。先在根目录建立uploadfile目录
     2。“值”与“图”:这是用于将此图片传到父窗口的。值,传的是文件名,可用于input;图,传的是图片,用于编辑器。在使用此功能时,先将“值”前面的文本框填写父窗口的ID值。我在用层弹出本程序时可正常赋值。
     3。可多个文件上传,如果目标目录有相同的文件,则重命名为“文件名(n).jpg",和FCKeditor一样的命名方式
  测试环境:apache2.2.14 + PHP5.3 + windowswww.php100.com
*/

阅读全文

php 生成word文档并下载代码

php教程 生成word文档并下载代码
include("include/conn_php教程.php");
  $id=$_GET["id"];
  $sql="select * from  down where id=$id ";
  $result=mysql_query($sql);  
  $row=mysql_fetch_row($result);
  $file2=$row["upload"];
 
function downFile($sFilePath)
{
   if(file_exists($sFilePath)){
       $aFilePath=explode("/",str_replace("php教程);
       $sFileName=$aFilePath[count($aFilePath)-1];
       $nFileSize=filesize ($sFilePath);
       header ("Content-Disposition: attachment; filename=" .basename($sFileName) );
       header ("Content-Length: " . $nFileSize);
       header ("Content-type: application/octet-stream");
       mb_convert_encoding(readfile($sFilePath),"utf-8","GB2312");
   }
   else
   {
       echo("文件不存在!");
   }
}

阅读全文

php购物车代码

这里我们为你提供个简单的php购物车代码哦,从增加购物产品与发生购买了,在商城开发中,这个功能是少不了的,我们不需要数据库,用了txt文本文件来操作用户购物的内容。

阅读全文