易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 :

php上传图片得到路径给表单字段赋值的通用方法

1. 调用方法例子:
大图路径:<input type="text" name="bigImageURL" id="bigImageURL"  value="">
<iframe src="uppic.php?id=bigImageURL" width="600" height="25" frameborder="0" scrolling="no"></iframe>
小图路径:
<input type="text" name="smallImageURL" id="smallImageURL" value="">
<iframe src="uppic.php?id=smallImageURL" width="600" height="25" frameborder="0" scrolling="no"></iframe>
2. uppic.php
<?php
header("Content-Type:text/html;charset=GB2312");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>图片上传</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.3790.4275" name=GENERATOR>
<style type="text/css">
<!--
input{border-width:1px;border:1px solid #bdbcbd;padding:3px 0 3px 5px;}
.inputb ......

好用的php过滤特殊字符

function htmldecode($str)
{
if(empty($str)) return;
if($str=="") return $str;
$str=str_replace("&",chr(34),$str);
$str=str_replace(">",">",$str);
$str=str_replace("<","<",$str);
$str=str_replace("&","&",$str);
$str=str_replace(" ",chr(32),$str);
$str=str_replace(" ",chr(9),$str);
$str=str_replace("'",chr(39),$str);
$str=str_replace("<br />",chr(13),$str);
$str=str_replace("''","'",$str);
$str=str_replace("select","select",$str);
$str=str_replace("join","join",$str);
$str=str_replace("union","union",$str);
$str=str_replace("where","where",$str);
$str=str_replace("insert","insert",$str);
$str=str_replace("delete","delete",$str);
$str=str_replace("update","update",$str);
$str=str_replace("like","like",$str);
$str=str_replace("drop","drop",$str);
$str=str_replace("create","create",$str);
$str=str_replace("modify","modify",$str);
$str=str_replace("rename","rename",$str);
$str=str_replace("alter","alter",$str);
$str=str_replace("cas","c ......

PHP并发访问例子

<?php
$start=$_GET['s'];
$end=$_GET['e'];

$requests = array();
for ($index = $start; $index < $end; $index++) {
$url="http://www.essort.com/amfphp/services/curl/loadTest.php?uid=$index";
$requests[]=$url;
}
$main = curl_multi_init();
$results = array();
$errors = array();
$info = array();
$count = count($requests);
for($i = 0; $i < $count; $i++) {
$handles[$i] = curl_init($requests[$i]);
var_dump($requests[$i]);
curl_setopt($handles[$i], CURLOPT_URL, $requests[$i]);
curl_setopt($handles[$i], CURLOPT_RETURNTRANSFER, 1);
curl_multi_add_handle($main, $handles[$i]);
}
$running = 0;
do {
curl_multi_exec($main, $running);
} while($running > 0);
for($i = 0; $i < $count; $i++)
{
$results[] = curl_multi_getcontent($handles[$i]);
$errors[] = curl_error($handles[$i]);
$info[] = curl_getinfo($handles[$i]);
curl_multi_remove_handle($main, $handles[$i]);
}
curl_multi_close($main);
var_dump($results);
var_dump($e ......

PHp代码规范


注:这是从PHPCMS开发文档里看到编码规范,虽名为PHPCMS的开发规范,但我觉得所有的PHP编程都该如此。写了那么多PHP,很多编码对照这规范都感觉欠缺很多,今后一定要对照纠正。
Phpcms 编码规范
1. 引言…. 2
2. 适用范围…. 2
3. 标准化的重要性和好处…. 3
4. PHP编码规范与原则…. 3
4.1. 代码标记… 3
4.2. 注释… 3
4.3. 书写规则… 4
4.3.1. 缩进… 4
4.3.2. 大括号{}、if和switch. 4
4.3.3. 运算符、小括号、空格、关键词和函数… 5
4.3.4. 函数定义… 6
4.3.5. 引号… 6
4.3.6. 多语言问题… 7
4.4. 命名原则… 8
4.4.1. 变量、对象、函数名… 8
4.4.2. 常量… 8
4.5. 变量的初始化与逻辑检查… 8
4.6. 安全性… 9
4.7. 兼容性… 9
4.8. 代码重用… 10
4.9. 其他细节问题… 10
4.9.1. 包含调用… 10
4.9.2. 错误报告级别… 11
5. 数据库设计…. 11
5.1. 字段… 11
5.1.1. 表和字段命名… 11
5.1.2. 字段结构… 11
5.2. SQL语句… 12
5.3. 性能与效率… ......

PHP配置SQL Server 2008

1、到微软官方去下载新的驱动,下载地址如下:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9
 
  官方文档有描述:
  Refer to the documentation that is installed with the driver for a description of the new features in this release. The SQL Server Driver for PHP download is available to all SQL Server users at no additional charge. The SQL Server Driver for PHP is a PHP 5 extension that allows for the reading and writing of SQL Server data from within PHP scripts. The extension provides a procedural interface for accessing data in all editions of SQL Server 2005 and SQL Server 2008.
  根据官方文档的描述,微软提供的Driver是同时提供给SQL Server 2005和SQL Server 2008两个版本使用的。
     下载驱动(上边有链接地址)下载过后的驱动包里面的内容如下图:
    
   
2、需要修改C:\WINDOWS\php.ini中的配置:
   查找;extension_dir 修改为extension_dir="E:\Pr ......

PHP配置SQL Server 2008

1、到微软官方去下载新的驱动,下载地址如下:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9
 
  官方文档有描述:
  Refer to the documentation that is installed with the driver for a description of the new features in this release. The SQL Server Driver for PHP download is available to all SQL Server users at no additional charge. The SQL Server Driver for PHP is a PHP 5 extension that allows for the reading and writing of SQL Server data from within PHP scripts. The extension provides a procedural interface for accessing data in all editions of SQL Server 2005 and SQL Server 2008.
  根据官方文档的描述,微软提供的Driver是同时提供给SQL Server 2005和SQL Server 2008两个版本使用的。
     下载驱动(上边有链接地址)下载过后的驱动包里面的内容如下图:
    
   
2、需要修改C:\WINDOWS\php.ini中的配置:
   查找;extension_dir 修改为extension_dir="E:\Pr ......

PHP连接SQL Server

使用过SQL Server的人应该都清楚,SQL Server常用的有两种认证方式,一种是本地系统账户认证(Windows Authentication ),一种是使用用户名和密码(SQL Server Authentication ),第二种认证方式必须启用SQL Server的混合模式。
  1.Windows Authentication连接部分代码段:
<?php
$serverName = "(local)";
$connectionInfo = array("Database"=>"TestingInfo","ConnectionPooling"=>false);
$conn = sqlsrv_connect( $serverName,$connectionInfo);
if( $conn == false)
{
    echo "连接失败!";
   die( print_r( sqlsrv_errors(), true));
}
?>
  2.SQL Server Authentication连接部分代码段:
<?php
$serverName = "(local)";
$uid = "sa";
$pwd = "******";
$connectionInfo =  array("UID"=>$uid,"PWD"=>$pwd,"Database"=>"TestingInfo");
$conn = sqlsrv_connect( $serverName,$connectionInfo);
if( $conn == false)
{
    echo "连接失败!";
   die( print_r( sqlsrv_errors(), true));
}
?>
  参考官方提供的英文原文档,针对参数$conne ......

PHP连接SQL Server

使用过SQL Server的人应该都清楚,SQL Server常用的有两种认证方式,一种是本地系统账户认证(Windows Authentication ),一种是使用用户名和密码(SQL Server Authentication ),第二种认证方式必须启用SQL Server的混合模式。
  1.Windows Authentication连接部分代码段:
<?php
$serverName = "(local)";
$connectionInfo = array("Database"=>"TestingInfo","ConnectionPooling"=>false);
$conn = sqlsrv_connect( $serverName,$connectionInfo);
if( $conn == false)
{
    echo "连接失败!";
   die( print_r( sqlsrv_errors(), true));
}
?>
  2.SQL Server Authentication连接部分代码段:
<?php
$serverName = "(local)";
$uid = "sa";
$pwd = "******";
$connectionInfo =  array("UID"=>$uid,"PWD"=>$pwd,"Database"=>"TestingInfo");
$conn = sqlsrv_connect( $serverName,$connectionInfo);
if( $conn == false)
{
    echo "连接失败!";
   die( print_r( sqlsrv_errors(), true));
}
?>
  参考官方提供的英文原文档,针对参数$conne ......
总记录数:40319; 总页数:6720; 每页6 条; 首页 上一页 [1785] [1786] [1787] [1788] 1789 [1790] [1791] [1792] [1793] [1794]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号