存档

‘PHP’ 分类的存档

PHP获取mysql自增后的ID

2011年10月14日 冰点浏览次数(30) 没有评论

PHP获取mysql自增后的使用mysql_insert_id()函数.

$result="INSERT INTO user VALUES (null,1,2,3)";
mysql_query($result);
echo mysql_insert_id();

PHP与webservice

2011年10月14日 冰点浏览次数(43) 没有评论

PHP 使用soap也是很方便的,直接看代码.

PHP 普通版:

webserviceServer服务端(soaps.php):

<?php
$soap = new SoapServer(null,array('uri'=>"http://localhost/"));
$soap->addFunction('minus_func');                                       
$soap->addFunction(SOAP_FUNCTIONS_ALL);
$soap->handle();
function minus_func($i, $j){
 $res = $i - $j;
 return $res;
}
?>

webserviceClient客户端调用:

<?php
try {
 $client = new SoapClient(null,  array('location' =>"http://localhost/soaps.php",'uri' => "http://localhost/")  );
 echo $client->minus_func(100,9);
} catch (SoapFault $fault){
 echo "dxbError: ",$fault->faultcode,", string: ",$fault->faultstring;
}
?> 阅读全文...
分类: PHP 标签: , ,

Flex音乐播放器(缓存进度,播放进度,声音控制,音频绘图)

2010年12月17日 冰点浏览次数(247) 没有评论

         前几天做了个FLex音乐播放器(FLEX+PHP),基本实现:缓存进度,播放进度,声音控制,音频绘图,在线增加音乐,在线删除音乐。就是界面不太好看.效果如下: 阅读全文…

在线生成FlashPaper文档

2010年10月25日 冰点浏览次数(1,016) 2 条评论

PHP方法:

【1】安装 FlashPaper2

【2】要在 PHP 中用 FlashPaper 的相对路径,需要为系统添加环境变量。如下:”我的电脑” –> 右键点击”属性” –> 选择“高级”选项卡 –> 点击“环境变量”按钮 –> 在“系统变量”中更改 “Path”的值,增加 FlashPaper 软件所在文件夹的绝对路径(我的是:C:\mencoder;C:\Program Files\Macromedia\FlashPaper 2)。 阅读全文…

分类: FLEX, PHP, Windows 标签: , ,

关于网站统计IP地址地区查询

2010年9月3日 冰点浏览次数(172) 没有评论

         建立了一个网站,想自己搞个统计,由于PHP技术不到家,所以用JS+PHP的方式.

不考虑JS禁用的用户,现在的网站有几个不用JS??

        收集了以下IP地址地区查询服务:http://j.maxmind.com/app/geoip.js

                                                 http://fw.qq.com/ipaddress

                                                  http://ip.wanvee.cn/GetIp.ashx?ipstr=21.123.23.123

                                                http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx

                                                还有个不知道是搜狐还是搜什么的网站提供的,搞忘记地址了 阅读全文…

php防止SQL注入函数

2010年8月7日 冰点浏览次数(301) 没有评论

1.函数的构建
/*
函数名称:inject_check()
函数作用:检测提交的值是不是含有SQL注射的字符,防止注射,保护服务器安全
参 数:$sql_str: 提交的变量
返 回 值:返回检测结果,ture or false
*/
function inject_check($sql_str)
{
return eregi(’select|insert|update|delete|’|/*|*|../|./|union|into|load_file|outfile’, $sql_str); // 进行过滤
} 阅读全文…

分类: PHP 标签:

PHP初学者头痛的九个问题

2010年8月7日 冰点浏览次数(101) 没有评论

1.页面之间无法传递变量
get,post,session在最新的php版本中自动全局变量是关闭的,所以要从上一页面取得提交过来得变量要使用$_GET['foo'],$_POST['foo'],$_SESSION['foo']来得到。当然也可以修改自动全局变量为开(php.ini改为register_globals = On);考虑到兼容性,还是强迫自己熟悉新的写法比较好。 阅读全文…

分类: PHP 标签:

PHP:GLOBAL变量解析

2010年5月24日 冰点浏览次数(275) 没有评论

1:Global的作用是定义全局变量,但是这个全局变量不是应用于整个网站,而是应用于当前页面,包括include或require的所有文件

$a=123;

function aa()
{
Global $a;  //如果不把$a定义为global变量,函数体内是不能访问$a的
echo $a;
}
aa();

总结:在函数体内定义的global变量,函数体外可以使用,在函数体外定义的global变量不能在函数体内使用,

$glpbal $a;
$a=123;

function f()
{
echo $a;   //错误,
}

//再看看下面一例

function f()
{
global $a;
$a=123;
} 阅读全文…

分类: PHP 标签: , ,

XAMP简化PHP+apache+mysql的安装过程

2010年5月24日 冰点浏览次数(1,017) 没有评论

许多人通过他们自己的经验认识到安装 Apache 服务器是件不容易的事儿。如果您想添加 MySQL、PHP 和 Perl,那就更难了。 

XAMPP 是一个易于安装且包含 MySQL、PHP 和 Perl 的 Apache 发行版。XAMPP 的确非常容易安装和使用:只需下载,解压缩,启动即可。 

到目前为止,XAMPP 共有以下四种版本 

适用于 Linux 系统;
适用于 Windows 98、NT、2000、XP 和 Vista 的发行版;
适用于 Mac OS X ;
 XAMPP 是免费的 

下载 XAMPP:http://www.apachefriends.org/download.php?xampp-win32-1.7.3.exe 阅读全文…

分类: APACHE, MYSQL, PHP 标签: , , , ,

PHP5中Cookie与Session详解

2010年4月6日 冰点浏览次数(249) 没有评论

1、Cookie的配置与应用
Setcookie(string name, string value, int expire,string path, string domain, int secure);
其中name是cookie变量名称标识,你在php中将能象使用普通变量名相同来用他引用cookie变量。value是cookie变量的初始值,expire 表示该cookie变量的有效时间;path 为该cookie变量的相关路径;domain 表示cookie变量的网站;secure 则需在 https 的安全传输时才有效。
 SetCookie(“Cookie”, “cookievalue”,time()+3600, “/forum”, “.hezo35.com”, 1);
(注:前两个参数是必须的)
  阅读全文…

分类: PHP 标签: , ,

关于session_satrt()的Cannot send session cache limiter – headers问题解决

2010年4月4日 冰点浏览次数(245) 没有评论

     在windows下编程,当使用session_start()方法的时候,有时会报
session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /var/www/inpublisher/php1.php:1)这样的错误,说是已经有输出,用编辑器打,前面明明什么都没有,原来在使用AJAX的时候,也出现过这种情况,后来,把这个PHP 文件放到linux 中打开,会发现,在文件的最前面,会出现“锘 ”这样的一个字符(引号内),把它去掉以后,再运行,OK,运行正常。后来在网上搜索一些文件,给的解释是:UTF8文件的BOM(Byte Order Mark)标志,在保存的时候会自动存入!
不管它是干嘛的,现在的目的就是把它去掉,我总结的方法有下面三种: 阅读全文…

PDO使用参考资源

2010年4月1日 冰点浏览次数(290) 没有评论

POD(PHP Data Object)扩展在PHP5中加入,PHP6中将默认识用PDO连接数据库,所有非PDO扩展将会在PHP6被从扩展中移除。该扩展提供PHP内置类 PDO来对数据库进行访问,不同数据库使用相同的方法名,解决数据库连接不统一的问题。
PDO的目标:
提供一种轻型、清晰、方便的 API
统一各种不同 RDBMS 库的共有特性,但不排除更高级的特性。
通过 PHP 脚本提供可选的较大程度的抽象/兼容性。
PDO的特点:
性能:PDO 从一开始就吸取了现有数据库扩展成功和失败的经验教训。因为 PDO 的代码是全新的,所以我们有机会重新开始设计性能,以利用 PHP 5 的最新特性。 阅读全文…

分类: MYSQL, PHP 标签: , , ,

godaddy空间PHP页面500 Internal Server Error解决办法

2010年4月1日 冰点浏览次数(2,336) 3 条评论

         because the Growing Client and visit capacity,the bandwidth of our website is not enough,so we change our space to godaddy.after I installing the PHP Application and databases.I find that I can not enter “admin platform”. the web page show “Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.” I open the google and find the solution.most of solution tell you to rename or delete the “.htaccess” file. other way is set the root root directory permission to 755. but the two way can not resolve the problem. I go to godaddy and open hosting control center,clicking ”settings” then from the drop down menu select “error.log” the page suggestion Apache error logs are disabled by default. You can enable error logs for a twenty-four hour period, during which time the logs are available through the CGI Admin panel. After the time period elapses, the error log is cleared. The twenty-four hour logging period can be invoked at any time. If this is done during an existing collection period, all previous log entries are deleted and collection begins anew. To enable error logs, click Update. To view error logs, click Launch CGI Admin I open the error logs “[Fri Mar 5 20:02:52 2010] [error] [client 116.**.***.***] user startuptechltd not found: /stats/error_logs/ [Fri Mar 5 20:04:50 2010] [error] [client 116.**.***.***](104)Connection reset by peer: FastCGI: comm with server “/var/chroot/home/content/s/t/a/*******/html-x-httpd-php5″ aborted: read failed [Fri Mar 5 20:04:50 2010] [error] [client 116.**.***.***]FastCGI: incomplete headers (0 bytes) received from server “/var/chroot/home/content/s/t/a/*******/html-x-httpd-php5″ [Fri Mar 5 20:04:56 2010] [error] [client 116.**.***.***](104)Connection reset by peer: FastCGI: comm with server 阅读全文…

.htaccess文件的配置方法

2010年3月25日 冰点浏览次数(168) 没有评论

.htaccess 文件
相关模块 相关指令
core
mod_authn_file
mod_authz_groupfile
mod_cgi
mod_include
mod_mime 阅读全文…

php5,MySQL5,apache2,phpmyadmin,ZendOptimizer安装与配置

2010年3月25日 冰点浏览次数(166) 没有评论

php环境的配置,对于新手来说,绝对是一件烦事.总会遇到这样那样的问题,走很多弯路.
所以特意写了这个配置文档,相信按照以下步骤你一定会成功的.错误的地方也希望各位指正. 阅读全文…