php 后退一页后的表单内容的保存

六月 29th, 2010 hew Posted in PHP开发 No Comments »

php表单在提交之后再后退,表单的内容默认是被清空的(使用session_start的时候),
解决方法是在session_start()之后,字符输出之前写上
header(“Cache-control: private”);

Tags: , ,


PHP 远程文件读取方法

六月 29th, 2010 hew Posted in PHP开发 No Comments »

1.file_get_contents

   1. < ?php         
   2. $url  = http: //www.phpabc.cn/;        
   3. $contents  =  file_get_contents ( $url );       
   4. //如果出现中文乱码使用下面代码        
   5. //$getcontent = iconv(”gb2312″, “utf-8″,file_get_contents($url));        
   6. //echo $getcontent;        
   7. echo   $contents ;       
   8. ?>

Tags: ,


php fscanf() 函数使用方法

六月 29th, 2010 hew Posted in PHP开发 No Comments »

Definition and Usage

  定义和用法

  The fscanf() function parses the input from an open file according to the specified format.

  fscanf()函数的作用是:从文件中按照指定的格式输入。

  Syntax

Tags: ,


IE、Firefox PHP设置cookie的区别

六月 29th, 2010 hew Posted in PHP开发 No Comments »

今天利用 Cookie 做网站的用户登录,经过调试,用
setcookie(“username”, “username”, time()+1000,”/php/”);
等储存用户的登录信息,然后利用
setcookie(“username”, “”, time()-3600);

Tags: , , ,


PHP代码执行漏洞总结

六月 29th, 2010 hew Posted in PHP开发 No Comments »

一 代码执行函数

PHP中可以 执行代码的函数。如eval()、assert()、“、system()、exec()、shell_exec()、passthru()、 escapeshellcmd()、pcntl_exec() 等

demo code 1.1:

<?php
echo `dir`;
?>

Tags: ,


php 对大文件进行读取操作

六月 29th, 2010 hew Posted in PHP开发 No Comments »

php对大文件进行读取操作

在php中,对于文件的读取时,最快捷的方式莫过于使用一些诸如file、file_get_contents之类的函数,简简单单的几行代码就能 很漂亮的完成我们所需要的功能。但当所操作的文件是一个比较大的文件时,这些函数可能就显的力不从心, 下面将从一个需求入手来说明对于读取大文件时,常用的操作方法。
需求

Tags: , ,


Page 8 of 12« First...56789101112