• PHP学习之提示标签


    1.鼠标停留在lable上时,调用jquery-1.8.3.min.js在lable的上方显示title的值。

    2.导出利用PHPExcel包,

       将数据输出至浏览器

     

     1 function array_to_excel($arrayHeader,$arrayContent,$download)
     2     {
     3           $objExcel = new PHPExcel();//创建一个处理对象实例 
     4           $objWriter  = new PHPExcel_Writer_Excel2007($objExcel); // 用于 2007 格式 
     5           $objProps = $objExcel->getProperties(); 
     6       
     7           $objExcel->setActiveSheetIndex(0);       
     8           $objActSheet = $objExcel->getActiveSheet();  
     9 
    10            $objActSheet->setTitle('广告活动(For CPA)报表'); 
    11            $arrayTitle=array(
    12                "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","x"
    13                ,"Y","Z"
    14            );
    15             header_to_excel($arrayHeader,$arrayTitle, $objActSheet);
    16             content_to_excel($arrayContent,$arrayTitle, $objActSheet);
    17             
    18             
    19 
    20           //直接输出到浏览器
    21         
    22            $objWriter = new PHPExcel_Writer_Excel5($objExcel);
    23           header("Pragma: public");
    24           header("Expires: 0");
    25           header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
    26           header("Content-Type:application/force-download");
    27           header("Content-Type:application/vnd.ms-execl");
    28           header('Content-Type: application/vnd.ms-excel;charset=utf-8');
    29           header("Content-Type:application/octet-stream");
    30           header("Content-Type:application/download");
    31           header("Content-Disposition:attachment;filename=$download");
    32           header("Content-Transfer-Encoding:binary");
    33           $objWriter->save("php://output");
    34           
    35     }

    3.验证码,加载Authcode.php

     1  <?php
     2  /**
     3   * 验证码类
     4   * @author ZhouHr
     5   * @version 0.1 <2013.10.28>
     6   */
     7 class Imgauthcode extends CI_Controller
     8 {
     9  
    10         public function __construct()
    11         {
    12                 parent::__construct();
    13                 $this->load->library('Authcode');
    14         }
    15  
    16         /**
    17          * 显示图片
    18          *
    19          */
    20         public function show()
    21         {
    22                 $this->authcode->show();
    23         }
    24  
    25         /**
    26          * js调用显示图片
    27          *
    28          */
    29         public function show_script()
    30         {
    31                 $this->authcode->showScript();
    32         }
    33         
    34         /**
    35          * ajax验证
    36          *
    37          */
    38         /*
    39         public function check()
    40         {
    41                 if ($this->authcode->check($this->uri->segment(3))) {
    42                         $xml_data['result'] = 'succeed';
    43                         $this->load->library('My_Xml');
    44                         echo XML_serialize($xml_data);
    45                 } else {
    46                         echo '验证码不正确,请重新输入';
    47                 }               
    48         }
    49         */
    50 }
  • 相关阅读:
    软件开发术语定义
    软件开发流程纲要及各个阶段产生的文档
    Java封装自己的Api
    Java中如何使封装自己的类,建立并使用自己的类库?
    Struts2中ActionContext和ServletActionContext
    TP-Link 无线路由器设置图文教程----怎么设置TP-Link无线路由器图解
    数据库(第一范式,第二范式,第三范式)
    ORACLE配置tnsnames.ora文件实例
    Windows下64位Apache服务器的安装
    公司内部Oracle RAC测试环境的简单使用说明.
  • 原文地址:https://www.cnblogs.com/LVAnny/p/php_libr.html
Copyright © 2020-2023  润新知