php分多步填写投票调查表单实现方法

 更新时间:2016年11月25日 17:30  点击:2083
本文章介绍了关于php分多步填写投票调查表单实现方法,大致为 把用户填写的内容获取之后保存在一个隐藏中,然后最后一步就一次提交给数据库。

1.php

 代码如下 复制代码
<form name=form1 id=form1 method=post action=2.php>
基本信息1:<input type=text name=base1 />
基本信息2:<input type=text name=base2 />
<input type=submit value="下一步">
</form>

2.php

 代码如下 复制代码
<form name=form2 id=form2 method=post action=3.php>
产品名称:<input type=text name=prcname />
产品价格:<input type=text name=price />
产品型号:<input type=text name=prcXH />
<input type=hidden name=base1 value="<?php echo $_REQUEST['base1'] ?>" />
<input type=hidden name=base2 value="<?php echo $_REQUEST['base2'] ?>" />
<input type=submit value=下一步 />
</form>

3.php

 代码如下 复制代码

<form name=form3 id=form3 method=post action=4.php>
其他信息1:<input type=text name=other1 />
其他信息2:<input type=text name=other2 />
<input type=hidden name=base1 value=<?php echo $_REQUEST['base1'] ?> />
<input type=hidden name=base2 value=<?php echo $_REQUEST['base2'] ?> />
<input type=hidden name=prcname value=<?php echo $_REQUEST['prcname'] ?> />
<input type=hidden name=price value=<?php echo $_REQUEST['price'] ?> />
<input type=hidden name=prcXH value=<?php echo $_REQUEST['prcXH'] ?> />
<input type=submit value=确定 />
</form>

4.php

 代码如下 复制代码

<?php
$base1=$_REQUEST['base1'];
$base2=$_REQUEST['base2'];
$prcname=$_REQUEST['prcname'];
$price=$_REQUEST['price'];
$prcXH=$_REQUEST['prcXH'];
$other1=$_REQUEST['other1'];
$other2=$_REQUEST['other2'];

$sql1="insert into [base_table](base1,base2) values('{$base1}','{$base2}')";
$sql2="insert into [prc_table](prcname,price,prcXH) values('{$prcname}','{$price}','{$prcXH}')";
$sql3="insert into [other_table](other1,other2) values('{$other1}','{$other2}')";
query($sql1);
query($sql2);
query($sql3);

echo "写入完成";
?>

总结

这种做的问题在于如果用户不小心关闭了页面数据将要重新再填写一次哦,不过这种方法很多大型网站都是这样做的,包括百度的百科里面的新手升级也是这样处理的。

php获取指定字符之间内容实现代码,这是一个获取字符串中两个子串之间的子串,如从字符串www.hzhuti.com中获取hzhuti子串,就让这个PHP函数来实现吧,

代码如下:

 代码如下 复制代码
function get_between($input, $start, $end) { 
 
  $substr = substr($input, strlen($start)+strpos($input, $start),
 
 (strlen($input) - strpos($input, $end))*(-1)); 
 
  return $substr; 
 

 
$string = "www.111cn.net"; 
 
$start = "www."; 
 
$end = ".com"; 
 
echo get_between($string, $start, $end);  // output:hzhuti

不过这个函数有个局限,就是$start子串和$end子串在整个串中只能出现一次。请看下面的例子:

 代码如下 复制代码
$string = "http://www.111cn.net/"; 
 
$start = "http://"; 
 
$end = "/";

很明显我想获取这个标准URL的域名部分,由于$end子串在整个串中不是唯一的,所以就会出现问题,请使用时务必注意!


NAS/NMS   COMPSITE   (NasdaqSC:^IXIC)   Quote   data   by   ReutersIndex   Value:2,030.08Trade   Time:5:16PM   ETChange:   35.40   (1.71%)Prev   Close:2,065.48Open:2,072.95Day 's   Range:2,026.20   -   2,073.4252wk   Range:1,359.32   -   2,153.831d

这样的一个字符串,我要截取Index   Value:和Trade   Time:之间的数据2,030.08,怎么截取?我要通用的方法

代码

 代码如下 复制代码

<?php
$str= "NAS/NMS   COMPSITE   (NasdaqSC:^IXIC)   Quote   data   by   ReutersIndex   Value:2,030.08Trade   Time:5:16PM   ETChange:   35.40   (1.71%)Prev   Close:2,065.48Open:2,072.95Day 's   Range:2,026.20   -   2,073.4252wk   Range:1,359.32   -   2,153.831d ";
preg_match( " 'Index   Value:(.+)Trade   Time 's ",$str,$arr);
if($arr){
      echo   $arr[ "1 "];
}
?>

本文章介绍了在php开发中的一些php 关闭错误提示方法,有需要的朋友可参考本文章。

一,关闭notice错误提示

1、在php.ini文件中改动error_reporting

改为:

 代码如下 复制代码

error_reporting=E_ALL & ~E_NOTICE

2、如果你不能操作php.ini文件,你可以使用如下方法

在你想禁止notice错误提示的页面中加入如下代码:

 代码如下 复制代码

error_reporting(E_ALL^E_NOTICE);

这样出现错误就不会再有任何提示了


二、关闭全部错误提示

php.ini中

打开PHP安装目录下的php.ini文件

 代码如下 复制代码

找到display_errors = On 修改为 display_errors = off

注意:如果你已经把PHP.ini文件复制到windows目录下,那么必须同时把 c:windows/php.ini里的display_errors = On 修改为display_errors = off

php程序开启
 

 代码如下 复制代码

<?php
//禁用错误报告
error_reporting(0);
//报告运行时错误
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//报告所有错误
error_reporting(E_ALL);
?>


 

在性能上关闭错误提示会给服务器性能负载加大不少哦

测试1:


在关闭错误显示的情况下,测试未初始化变量和已初始化变量在10000000次循环中的性能

变量已初始化的循环代码如下:

变量未初始化的循环代码如下:

测试成绩:


初始化:平均 5.28 秒

未初始化:平均 17.2 秒

性能差距:3.25倍


平均时间表:

我们可以看到,关闭掉PHP错误输出并不会关闭php内核对错误的处理,代码中如果有大量的Notice级别的错误,还是会降低php程序的性能。

多文件上传是PHP中的一个基础应用,反正PHPer都会遇到的问题,现在就介绍一个功能完善、强大的多文件上传类给大家吧,能用上这个类的地方会很多

 代码如下 复制代码

<?php

class Upload{
 var $saveName;// 保存名
 var $savePath;// 保存路径
 var $fileFormat = array('gif','jpg','doc','application/octet-stream');// 文件格式&MIME限定
 var $overwrite = 0;// 覆盖模式
 var $maxSize = 0;// 文件最大字节
 var $ext;// 文件扩展名
 var $thumb = 0;// 是否生成缩略图
 var $thumbWidth = 130;// 缩略图宽
 var $thumbHeight = 130;// 缩略图高
 var $thumbPrefix = "_thumb_";// 缩略图前缀
 var $errno;// 错误代号
 var $returnArray= array();// 所有文件的返回信息
 var $returninfo= array();// 每个文件返回信息


// 构造函数
// @param $savePath 文件保存路径
// @param $fileFormat 文件格式限制数组
// @param $maxSize 文件最大尺寸
// @param $overwriet 是否覆盖 1 允许覆盖 0 禁止覆盖

 function Upload($savePath, $fileFormat='',$maxSize = 0, $overwrite = 0) {
  $this->setSavepath($savePath);
  $this->setFileformat($fileFormat);
  $this->setMaxsize($maxSize);
  $this->setOverwrite($overwrite);
  $this->setThumb($this->thumb, $this->thumbWidth,$this->thumbHeight);
  $this->errno = 0;
 }

// 上传
// @param $fileInput 网页Form(表单)中input的名称
// @param $changeName 是否更改文件名
 function run($fileInput,$changeName = 1){
  if(isset($_FILES[$fileInput])){
   $fileArr = $_FILES[$fileInput];
   if(is_array($fileArr['name'])){//上传同文件域名称多个文件
    for($i = 0; $i < count($fileArr['name']); $i++){
     $ar['tmp_name'] = $fileArr['tmp_name'][$i];
     $ar['name'] = $fileArr['name'][$i];
     $ar['type'] = $fileArr['type'][$i];
     $ar['size'] = $fileArr['size'][$i];
     $ar['error'] = $fileArr['error'][$i];
     $this->getExt($ar['name']);//取得扩展名,赋给$this->ext,下次循环会更新
     $this->setSavename($changeName == 1 ? '' : $ar['name']);//设置保存文件名
     if($this->copyfile($ar)){
      $this->returnArray[] =  $this->returninfo;
     }else{
      $this->returninfo['error'] = $this->errmsg();
      $this->returnArray[] =  $this->returninfo;
     }
    }
    return $this->errno ?  false :  true;
   }else{//上传单个文件
    $this->getExt($fileArr['name']);//取得扩展名
    $this->setSavename($changeName == 1 ? '' : $fileArr['name']);//设置保存文件名
    if($this->copyfile($fileArr)){
     $this->returnArray[] =  $this->returninfo;
    }else{
     $this->returninfo['error'] = $this->errmsg();
     $this->returnArray[] =  $this->returninfo;
    }
    return $this->errno ?  false :  true;
   }
   return false;
  }else{
   $this->errno = 10;
   return false;
  }
 }

// 单个文件上传
// @param $fileArray 文件信息数组
 function copyfile($fileArray){
  $this->returninfo = array();
  // 返回信息
  $this->returninfo['name'] = $fileArray['name'];
  $this->returninfo['md5'] = @md5_file($fileArray['tmp_name']);
  $this->returninfo['saveName'] = $this->saveName;
  $this->returninfo['size'] = number_format( ($fileArray['size'])/1024 , 0, '.', ' ');//以KB为单位
  $this->returninfo['type'] = $fileArray['type'];
  // 检查文件格式
  if (!$this->validateFormat()){
   $this->errno = 11;
   return false;
  }
  // 检查目录是否可写
  if(!@is_writable($this->savePath)){
   $this->errno = 12;
   return false;
  }
  // 如果不允许覆盖,检查文件是否已经存在
  //if($this->overwrite == 0 && @file_exists($this->savePath.$fileArray['name'])){
  // $this->errno = 13;
  // return false;
  //}
  // 如果有大小限制,检查文件是否超过限制
  if ($this->maxSize != 0 ){
   if ($fileArray["size"] > $this->maxSize){
    $this->errno = 14;
    return false;
   }
  }
  // 文件上传
  if(!@move_uploaded_file($fileArray["tmp_name"], $this->savePath.$this->saveName)){
   $this->errno = $fileArray["error"];
   return false;
  }elseif( $this->thumb ){// 创建缩略图
   $CreateFunction = "imagecreatefrom".($this->ext == 'jpg' ? 'jpeg' : $this->ext);
   $SaveFunction = "image".($this->ext == 'jpg' ? 'jpeg' : $this->ext);
   if (strtolower($CreateFunction) == "imagecreatefromgif"
    && !function_exists("imagecreatefromgif")) {
    $this->errno = 16;
    return false;
   } elseif (strtolower($CreateFunction) == "imagecreatefromjpeg"
    && !function_exists("imagecreatefromjpeg")) {
    $this->errno = 17;
    return false;
   } elseif (!function_exists($CreateFunction)) {
    $this->errno = 18;
    return false;
   }
    
   $Original = @$CreateFunction($this->savePath.$this->saveName);
   if (!$Original) {$this->errno = 19; return false;}
   $originalHeight = ImageSY($Original);
   $originalWidth = ImageSX($Original);
   $this->returninfo['originalHeight'] = $originalHeight;
   $this->returninfo['originalWidth'] = $originalWidth;
   /*
   if (($originalHeight < $this->thumbHeight
    && $originalWidth < $this->thumbWidth)) {
    // 如果比期望的缩略图小,那只Copy
    move_uploaded_file($this->savePath.$this->saveName,
     $this->savePath.$this->thumbPrefix.$this->saveName);
   } else {
    if( $originalWidth > $this->thumbWidth ){// 宽 > 设定宽度
     $thumbWidth = $this->thumbWidth ;
     $thumbHeight = $this->thumbWidth * ( $originalHeight / $originalWidth );
     if($thumbHeight > $this->thumbHeight){// 高 > 设定高度
      $thumbWidth = $this->thumbHeight * ( $thumbWidth / $thumbHeight );
      $thumbHeight = $this->thumbHeight ;
     }
    }elseif( $originalHeight > $this->thumbHeight ){// 高 > 设定高度
     $thumbHeight = $this->thumbHeight ;
     $thumbWidth = $this->thumbHeight * ( $originalWidth / $originalHeight );
     if($thumbWidth > $this->thumbWidth){// 宽 > 设定宽度
      $thumbHeight = $this->thumbWidth * ( $thumbHeight / $thumbWidth );
      $thumbWidth = $this->thumbWidth ;
     }
    }
    */
    $radio=max(($originalWidth/$this->thumbWidth),($originalHeight/$this->thumbHeight));
    $thumbWidth=(int)$originalWidth/$radio;
    $thumbHeight=(int)$originalHeight/$radio;

    if ($thumbWidth == 0) $thumbWidth = 1;
    if ($thumbHeight == 0) $thumbHeight = 1;
    $createdThumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
    if ( !$createdThumb ) {$this->errno = 20; return false;}
    if ( !imagecopyresampled($createdThumb, $Original, 0, 0, 0, 0,
     $thumbWidth, $thumbHeight, $originalWidth, $originalHeight) )
     {$this->errno = 21; return false;}
    if ( !$SaveFunction($createdThumb,
     $this->savePath.$this->thumbPrefix.$this->saveName) )
     {$this->errno = 22; return false;}
   
  }
  // 删除临时文件
  /*
  if(!@$this->del($fileArray["tmp_name"])){
   return false;
  }
  */
  return true;
 }

// 文件格式检查,MIME检测
 function validateFormat(){
  if(!is_array($this->fileFormat)
   || in_array(strtolower($this->ext), $this->fileFormat)
   || in_array(strtolower($this->returninfo['type']), $this->fileFormat) )
   return true;
  else
   return false;
 }
// 获取文件扩展名
// @param $fileName 上传文件的原文件名
 function getExt($fileName){
  $ext = explode(".", $fileName);
  $ext = $ext[count($ext) - 1];
  $this->ext = strtolower($ext);
 }

// 设置上传文件的最大字节限制
// @param $maxSize 文件大小(bytes) 0:表示无限制
 function setMaxsize($maxSize){
  $this->maxSize = $maxSize;
 }
// 设置文件格式限定
// @param $fileFormat 文件格式数组
 function setFileformat($fileFormat){
  if(is_array($fileFormat)){$this->fileFormat = $fileFormat ;}
 }

// 设置覆盖模式
// @param overwrite 覆盖模式 1:允许覆盖 0:禁止覆盖
 function setOverwrite($overwrite){
  $this->overwrite = $overwrite;
 }


// 设置保存路径
// @param $savePath 文件保存路径:以 "/" 结尾,若没有 "/",则补上
 function setSavepath($savePath){
  $this->savePath = substr( str_replace("\","/", $savePath) , -1) == "/"
  ? $savePath : $savePath."/";
 }

// 设置缩略图
// @param $thumb = 1 产生缩略图 $thumbWidth,$thumbHeight 是缩略图的宽和高
 function setThumb($thumb, $thumbWidth = 0,$thumbHeight = 0){
  $this->thumb = $thumb;
  if($thumbWidth) $this->thumbWidth = $thumbWidth;
  if($thumbHeight) $this->thumbHeight = $thumbHeight;
 }

// 设置文件保存名
// @param $saveName 保存名,如果为空,则系统自动生成一个随机的文件名
 function setSavename($saveName){
  if ($saveName == ''){  // 如果未设置文件名,则生成一个随机文件名
   $name = date('YmdHis')."_".rand(100,999).'.'.$this->ext;
   //判断文件是否存在,不允许重复文件
   if(file_exists($this->savePath . $name)){
    $name = setSavename($saveName);
    }
  } else {
   $name = $saveName;
  }
  $this->saveName = $name;
 }

// 删除文件
// @param $fileName 所要删除的文件名
 function del($fileName){
  if(!@unlink($fileName)){
   $this->errno = 15;
   return false;
  }
  return true;
 }

// 返回上传文件的信息
 function getInfo(){
  return $this->returnArray;
 }

// 得到错误信息
 function errmsg(){
  $uploadClassError = array(
   0 =>'There is no error, the file uploaded with success. ',
   1 =>'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
   2 =>'The uploaded file exceeds the MAX_FILE_SIZE that was specified in the HTML form.',
   3 =>'The uploaded file was only partially uploaded. ',
   4 =>'No file was uploaded. ',
   6 =>'Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. ',
   7 =>'Failed to write file to disk. Introduced in PHP 5.1.0. ',
   10 =>'Input name is not unavailable!',
   11 =>'The uploaded file is Unallowable!',
   12 =>'Directory unwritable!',
   13 =>'File exist already!',
   14 =>'File is too big!',
   15 =>'Delete file unsuccessfully!',
   16 =>'Your version of PHP does not appear to have GIF thumbnailing support.',
   17 =>'Your version of PHP does not appear to have JPEG thumbnailing support.',
   18 =>'Your version of PHP does not appear to have pictures thumbnailing support.',
   19 =>'An error occurred while attempting to copy the source image .
     Your version of php ('.phpversion().') may not have this image type support.',
   20 =>'An error occurred while attempting to create a new image.',
   21 =>'An error occurred while copying the source image to the thumbnail image.',
   22 =>'An error occurred while saving the thumbnail image to the filesystem.
     Are you sure that PHP has been configured with both read and write access on this folder?',
   );
  if ($this->errno == 0)
   return false;
  else
   return $uploadClassError[$this->errno];
 }
}

?>
如何使用这个类呢?

<?php
//如果收到表单传来的参数,则进行上传处理,否则显示表单
if(isset($_FILES['uploadinput'])){
 //建目录函数,其中参数$directoryName最后没有"/",
 //要是有的话,以'/'打散为数组的时候,最后将会出现一个空值
 function makeDirectory($directoryName) {
  $directoryName = str_replace("\","/",$directoryName);
  $dirNames = explode('/', $directoryName);
  $total = count($dirNames) ;
  $temp = '';
  for($i=0; $i<$total; $i++) {
   $temp .= $dirNames[$i].'/';
   if (!is_dir($temp)) {
    $oldmask = umask(0);
    if (!mkdir($temp, 0777)) exit("不能建立目录 $temp");
    umask($oldmask);
   }
  }
  return true;
 }

 if($_FILES['uploadinput']['name'] <> ""){
  //包含上传文件类
  require_once ('upload_class.php');
  //设置文件上传目录
  $savePath = "upload";
  //创建目录
  makeDirectory($savePath);
  //允许的文件类型
  $fileFormat = array('gif','jpg','jpge','png');
  //文件大小限制,单位: Byte,1KB = 1000 Byte
  //0 表示无限制,但受php.ini中upload_max_filesize设置影响
  $maxSize = 0;
  //覆盖原有文件吗? 0 不允许  1 允许
  $overwrite = 0;
  //初始化上传类
  $f = new Upload( $savePath, $fileFormat, $maxSize, $overwrite);
  //如果想生成缩略图,则调用成员函数 $f->setThumb();
  //参数列表: setThumb($thumb, $thumbWidth = 0,$thumbHeight = 0)
  //$thumb=1 表示要生成缩略图,不调用时,其值为 0
  //$thumbWidth  缩略图宽,单位是像素(px),留空则使用默认值 130
  //$thumbHeight 缩略图高,单位是像素(px),留空则使用默认值 130
  $f->setThumb(1);
  
  //参数中的uploadinput是表单中上传文件输入框input的名字
  //后面的0表示不更改文件名,若为1,则由系统生成随机文件名
  if (!$f->run('uploadinput',1)){
   //通过$f->errmsg()只能得到最后一个出错的信息,
   //详细的信息在$f->getInfo()中可以得到。
   echo $f->errmsg()."<br>n";
  }
  //上传结果保存在数组returnArray中。
  echo "<pre>";
  print_r($f->getInfo());
  echo "</pre>";
 }
}else{
?>
<form enctype="multipart/form-data" action="" method="POST">
Send this file: <br />
<input name="uploadinput[]" type="file"><br />
<input name="uploadinput[]" type="file"><br />
<input name="uploadinput[]" type="file"><br />
<input type="submit" value="Send File"><br />
</form>
<?php
}

?>

浏览器打开页面实现文件下载的程序代码(php/jsp/java) 有需要学习的同学可参考一下。

tomcat中配置如下:

 代码如下 复制代码

    <mime-mapping>
        <extension>txt</extension>
        <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>jpg</extension>
        <mime-type>application/octet-stream</mime-type>
    </mime-mapping>

对于如上配置,当访问扩展名txt或jpg的资源时就出现下载提示框,如果只需要对某些提到的资源让其出现下载提示框,上述配置就不行了,解决的方法是在资源的response头中设置content-type即可,例如:

php 中

 代码如下 复制代码

header("Content-type:application/octet-stream");
header('Content-Disposition: attachment; filename="downloaded.txt"');

下载文件程序

 代码如下 复制代码
<?
header("content-type:text/html; charset=utf-8");
$file_name=$_GET['name']; //服务器的真实文件名
$file_realName=urldecode($_GET['real']); //数据库的文件名urlencode编码过的
$file_dir="upload/";
$file = fopen($file_dir . $file_name,"r"); // 打开文件
// 输入文件标签
header( "Pragma: public" );
header( "Expires: 0" );
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize($file_dir . $file_name));
Header("Content-Disposition: attachment; filename=" . iconv("UTF-8","GB2312//TRANSLIT",$file_realName));
// 输出文件内容
echo fread($file,filesize($file_dir . $file_name));
fclose($file);
exit;
?>


java 中

 代码如下 复制代码
response.setContentType("application/octet-stream");
resp.setHeader("Content-Disposition", "attachment;filename="downloaded.txt");

如果需要为下载设置一个保存的名字,可以用Content-Disposition属性来指定。

实例

 代码如下 复制代码

<%@page language="java" contentType="application/x-msdownload" import="java.io.*,java.net.*" pageEncoding="gbk"%><%
  response.reset();//可以加也可以不加
  response.setContentType("application/x-download");//设置为下载application/x-download
  // /../../退WEB-INF/classes两级到应用的根目录下去,注意Tomcat与WebLogic下面这一句得到的路径不同,WebLogic中路径最后没有/
  ServletContext context = session.getServletContext();
  String realContextPath = context.getRealPath("")+"\plan\计划数据模板.xls";
  String filenamedisplay = "计划数据模板.xls";
  filenamedisplay = URLEncoder.encode(filenamedisplay,"UTF-8");
  response.addHeader("Content-Disposition","attachment;filename=" + filenamedisplay);
  OutputStream output = null;
  FileInputStream fis = null;
  try
  {
  output  = response.getOutputStream();
  fis = new FileInputStream(realContextPath);
  byte[] b = new byte[1024];
  int i = 0;
  while((i = fis.read(b)) > 0)
  {
  output.write(b, 0, i);
  }
  output.flush();
  }
  catch(Exception e)
  {
  System.out.println("Error!");
  e.printStackTrace();
  }
  finally
  {
  if(fis != null)
  {
  fis.close();
  fis = null;
  }
  if(output != null)
  {
  output.close();
  output = null;
  }
  }
  %>

[!--infotagslink--]

相关文章

  • php 中file_get_contents超时问题的解决方法

    file_get_contents超时我知道最多的原因就是你机器访问远程机器过慢,导致php脚本超时了,但也有其它很多原因,下面我来总结file_get_contents超时问题的解决方法总结。...2016-11-25
  • php抓取网站图片并保存的实现方法

    php如何实现抓取网页图片,相较于手动的粘贴复制,使用小程序要方便快捷多了,喜欢编程的人总会喜欢制作一些简单有用的小软件,最近就参考了网上一个php抓取图片代码,封装了一个php远程抓取图片的类,测试了一下,效果还不错分享...2015-10-30
  • php语言实现redis的客户端

    php语言实现redis的客户端与服务端有一些区别了因为前面介绍过服务端了这里我们来介绍客户端吧,希望文章对各位有帮助。 为了更好的了解redis协议,我们用php来实现...2016-11-25
  • HTTP 408错误是什么 HTTP 408错误解决方法

    相信很多站长都遇到过这样一个问题,访问页面时出现408错误,下面一聚教程网将为大家介绍408错误出现的原因以及408错误的解决办法。 HTTP 408错误出现原因: HTT...2017-01-22
  • jQuery+jRange实现滑动选取数值范围特效

    有时我们在页面上需要选择数值范围,如购物时选取价格区间,购买主机时自主选取CPU,内存大小配置等,使用直观的滑块条直接选取想要的数值大小即可,无需手动输入数值,操作简单又方便。HTML首先载入jQuery库文件以及jRange相关...2015-03-15
  • Android子控件超出父控件的范围显示出来方法

    下面我们来看一篇关于Android子控件超出父控件的范围显示出来方法,希望这篇文章能够帮助到各位朋友,有碰到此问题的朋友可以进来看看哦。 <RelativeLayout xmlns:an...2016-10-02
  • ps把文字背景变透明的操作方法

    ps软件是现在非常受大家喜欢的一款软件,有着非常不错的使用功能。这次文章就给大家介绍下ps把文字背景变透明的操作方法,喜欢的一起来看看。 1、使用Photoshop软件...2017-07-06
  • intellij idea快速查看当前类中的所有方法(推荐)

    这篇文章主要介绍了intellij idea快速查看当前类中的所有方法,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2020-09-02
  • Mysql select语句设置默认值的方法

    1.在没有设置默认值的情况下: 复制代码 代码如下:SELECT userinfo.id, user_name, role, adm_regionid, region_name , create_timeFROM userinfoLEFT JOIN region ON userinfo.adm_regionid = region.id 结果:...2014-05-31
  • js导出table数据到excel即导出为EXCEL文档的方法

    复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta ht...2013-10-13
  • mysql 批量更新与批量更新多条记录的不同值实现方法

    批量更新mysql更新语句很简单,更新一条数据的某个字段,一般这样写:复制代码 代码如下:UPDATE mytable SET myfield = 'value' WHERE other_field = 'other_value';如果更新同一字段为同一个值,mysql也很简单,修改下where即...2013-10-04
  • JS实现的简洁纵向滑动菜单(滑动门)效果

    本文实例讲述了JS实现的简洁纵向滑动菜单(滑动门)效果。分享给大家供大家参考,具体如下:这是一款纵向布局的CSS+JavaScript滑动门代码,相当简洁的手法来实现,如果对颜色不满意,你可以试着自己修改CSS代码,这个滑动门将每一...2015-10-21
  • ps怎么制作倒影 ps设计倒影的方法

    ps软件是一款非常不错的图片处理软件,有着非常不错的使用效果。这次文章要给大家介绍的是ps怎么制作倒影,一起来看看设计倒影的方法。 用ps怎么做倒影最终效果&#819...2017-07-06
  • js基础知识(公有方法、私有方法、特权方法)

    本文涉及的主题虽然很基础,在许多人看来属于小伎俩,但在JavaScript基础知识中属于一个综合性的话题。这里会涉及到对象属性的封装、原型、构造函数、闭包以及立即执行表达式等知识。公有方法 公有方法就是能被外部访问...2015-11-08
  • 安卓手机wifi打不开修复教程,安卓手机wifi打不开解决方法

    手机wifi打不开?让小编来告诉你如何解决。还不知道的朋友快来看看。 手机wifi是现在生活中最常用的手机功能,但是遇到手机wifi打不开的情况该怎么办呢?如果手机wifi...2016-12-21
  • PHP 验证码不显示只有一个小红叉的解决方法

    最近想自学PHP ,做了个验证码,但不知道怎么搞的,总出现一个如下图的小红叉,但验证码就是显示不出来,原因如下 未修改之前,出现如下错误; (1)修改步骤如下,原因如下,原因是apache权限没开, (2)点击打开php.int., 搜索extension=ph...2013-10-04
  • c#中分割字符串的几种方法

    单个字符分割 string s="abcdeabcdeabcde"; string[] sArray=s.Split('c'); foreach(string i in sArray) Console.WriteLine(i.ToString()); 输出下面的结果: ab de...2020-06-25
  • js控制页面控件隐藏显示的两种方法介绍

    javascript控制页面控件隐藏显示的两种方法,方法的不同之处在于控件隐藏后是否还在页面上占位 方法一: 复制代码 代码如下: document.all["panelsms"].style.visibility="hidden"; document.all["panelsms"].style.visi...2013-10-13
  • 连接MySql速度慢的解决方法(skip-name-resolve)

    最近在Linux服务器上安装MySql5后,本地使用客户端连MySql速度超慢,本地程序连接也超慢。 解决方法:在配置文件my.cnf的[mysqld]下加入skip-name-resolve。原因是默认安装的MySql开启了DNS的反向解析。如果禁用的话就不能...2015-10-21
  • C#方法的总结详解

    本篇文章是对C#方法进行了详细的总结与介绍,需要的朋友参考下...2020-06-25