function img_exits($http://pic2.phprm.com/2010/08/24/url.jpg)
{
    $ch = curl_init();
    curl_setopt($ch, curlopt_url,$url);
    curl_setopt($ch, curlopt_nobody, 1); // 不下载
    curl_setopt($ch, curlopt_failonerror, 1);
    curl_setopt($ch, curlopt_returntransfer, 1);
php jquery 验证码代码
<?php
//调用此页面,如果下面的式子成立,则生成验证码图片
if($_get['action']=='verifycode'){
    rand_create();
}
//验证码图片生成
php mysql数据库操作教程
//连接mysql数据库
 
//查询mysql字段名
简单实用php mysql分页代码
$qh=mysql_query("select count(*) as rcnt from table where your_condition_here order by whatever");
$data=mysql_fetch_array($qh);
$nr=$data["rcnt"];
//判断偏移量参数是否传递给了脚本,如果没有就使用默认值0
php mysq数据编辑更新实例
$db = mysql教程_connect("localhost", "phpdb", "phpdb");
mysql_select_db("test",$db);
// 如果提交了submit按钮
if ($submit) {  
   // 如果没有id,则是在增加记录,否则是在修改记录
   if ($id) {
     $sql = "update employees set first='$first',last='$last',     address='$address',position='$position' where id=$id";
   }
   else {
     $sql = "insert into employees (first,last,address,position) values ('$first','$last','$address','$position')";
   }  
   // 向数据库教程发出sql命令
   $result = mysql_query($sql);
   echo "记录修改成功!<>";
   echo "<a href='$php_self'>返回</a>";
}
elseif ($delete) {
 // 删除一条记录
     $sql = "delete from employees where id=$id";
     $result = mysql_query($sql);
     echo "记录删除成功!<>";
  echo "<a href='$php_self'>返回</a>";
}
else {  
   // 如果还没有按submit按钮,那么执行下面这部分程序
   if (!$id) {    
     // 如果不是修改状态,则显示员工列表
     $result = mysql_query("select * from employees",$db);
     while ($myrow = mysql_fetch_array($result)) {
       printf("<a href="%s?id=%s">%s %s</a> ",
        $php_self, $myrow["id"], $myrow["first"], $myrow["last"]);
    printf("<a href="%s?id=%s&delete=yes">(delete)</a><br>",  $php_self, $myrow["id"]);
     }
}
?>
   <a href="<?php echo  $php_self?>">返回</a>
   <form method="post" action="<?php echo  $php_self?>">
   <?php
   if ($id) {
     // 是在编辑修改状态,因些选择一条记录
     $sql = "select * from employees where id=$id";
     $result = mysql_query($sql);
     $myrow = mysql_fetch_array($result);
     $id = $myrow["id"];
     $first = $myrow["first"];
     $last = $myrow["last"];
     $address = $myrow["address"];
     $position = $myrow["position"];
     // 显示id,供用户编辑修改
     ?>
     <input type=hidden name="id" value="<?php echo $id ?>">
     <?php
   }
   ?>
   名:<input type="text" name="first" value="<?php echo $first ?>">
   姓:<input type="text" name="last" value="<?php echo $last ?>">
   <br>
   住址:<input type="text" name="address" value="<?php echo $address ?>">
   职位:<input type="text" name="position" value="<?php echo $position ?>">
   <br>
   <input type="submit" name="submit" value="输入信息">
   </form>
<?php
}
?>
</body>
</html>
php写的网页计数器代码
<html>
<head>
<title>php教程写的网页计数器代码</title>
<head>
<body>
<?php
$countfile = "counter.txt";
//定义计数器写入的文件是当前目录下的counter.txt文件中,然后我们应当测试该文件能否打开
if (($fp = fopen($countfile, "r+")) == false) {
 //用读写模式打开文件,若不能打开就退出
 printf ("open file %s failed!",$countfile);
 exit;
}
else
{
//如果文件能够正常打开,就读入文件中的数据,假设是1
$count = fread ($fp,10);
//读取10位数据
$count = $count + 1;
//count ++
fclose ($fp);
//关闭当前文件
$fp = fopen($countfile, "w+");
//以覆盖模式打开文件
fwrite ($fp,$count);
//写入加1后的新数据
fputs($fp,$fg);
//显示计数结果
// 数字显示
echo "<div align=center><font size=5>计数次数:$count</font><br>";
php上传图片代码(同时图片保存到数据库)
// 连接数据库
$conn = mysql_connect("localhost", "phpdb", "phpdb");
mysql_select_db("test",$conn);
?>
<?
// 取得网页的参数
$id=$_post['id'];
file_get_contents获取远程网页内容函数
无限file_get_contents获取远程网页内容函数
/*
由于某种原因把php教程的allow_url_fopen选项是关闭了,就是没法直接使用file_get_contents来获取远程web页面的内容。那就是可以使用另外一个函数curl。
php利用ExcelFileParser把excel导入数据库
这是一款实用的php教程利用excelfileparser把excel导入数据库教程哦。
parese.php文件
php 判断用户是否登录
<?php教程
session_start();
if(getconfig("chatroom_admin")==$_post["username"]&&getconfig("chatroom_adminpassword")==md5($_post["password"]))
{
 //登陆成功,注册session
 session_register("administrator");
 if(isset($_session["hack_num"]))
 {
  session_unregister("hack_num");
 }
 $_session["administrator"] = "yes";
 header("location:main.php");
 exit;
}
else
{
 if($_session["hack_num"]=="")
 {
  session_register("hack_num");
  $_session["hack_num"] = 1;
 }
 else
 {
  $_session["hack_num"] ++;
输出合法php格式文件 var_export
var_export
(php教程 4 >= 4.2.0, php 5)
var_export -- 输出或返回一个变量的字符串表示
描述
此函数返回关于传递给该函数的变量的结构信息,它和 var_dump() 类似,不同的是其返回的表示是合法的 php 代码。
您可以通过将函数的第二个参数设置为 true,从而返回变量的表示。
eg:
php 用户登录代码
<?
error_reporting(0);
if(isset($_post['post']) && $_post['post']=="1"){
$mysql教程_servername = "localhost"; 
$mysql_username = "root"; 
$mysql_password =""; 
$mysql_database ="peng"; 
mysql_connect($mysql_servername , $mysql_username , $mysql_password);
mysql_select_db($mysql_database); 
$name=$_post['name'];
$passowrd=$_post['password'];