| |
PHP工具
PHP是一种新型的CGI程序编写语言,易学易用,运行速度快,可以方便快捷地编写出功能强大,运行
速度快,并可同时运行于Windows、Unix、Linux平台的Web后台程序,内置了对文件上传、密码认证、Cookies
操作、邮件收发、动态GIF生成等功能,PHP3直接为很多数据库提供原本的连接,包括Oracle,Sybase, Postgres,Mysql,Informix,Dbase,Solid,Access等,完全支持ODBC接口,用户更换平台时,无需变换PHP3
代码,可即拿即用。Php3Server完全免费。PHP4.0提供了更多web server的支持,例如Zeus,Netscape
Enterprise,Apache Win32module,并增加了很多性能,并修正了很多bug。
一、 文件来源
http://www.php.net
http://www.newhua..com 的"吉通站"-->软件分类-->网络工具-->主页制作
php-4.0.6-win32.zip V4.0.6 running under win98/me/nt/2000
php-4.1.1-win32.zip V4.1.1 running under win98/me/nt/2000
php-4.1.1-installer.exe
二、 安装及配置
1.将.zip解到一指定目录下(例:f:\php),然后将f:\php下的php.ini-dist另存到\winnt目录下且改名为php.ini,再修改php.ini,修改的内容为:
;extension=php_mssql.dll --> extension=php_mssql.dll 支持mssql_connect()等函数的使用,否则报mssql_connect()等函数未定义
extension_dir = ./ --> extension_dir = f:\php406\extensions\
指定php_mssql.dll的路径,否则报找不到php_mssql.dll
[mail function]
; For Win32 only.
SMTP = 210.35.240.3
; For Win32 only.
sendmail_from = ayfu@ncu.edu.cn
起用mail()函数
2.Copy f:\php\extensions\php_mssql.dll \winnt\system32
3.在IIS中配制:
主目录-->配置-->增加 .php f:\php\php.exe
ISAPI筛选器-->增加 F:\php\sapi\php4isapi.dll
三、 使用适宜的编辑器:Editplus.exe V2.11
一套功能强大,可取代记事本的文字编辑器,拥有无限制的Undo/Redo、英文拼字检查、自动换行、列数标记、搜寻取代、同时编辑多文件、全屏幕浏览功能。而它还有一个好用的功能,就是它有监视剪贴簿的功能,能够同步于剪贴簿自动将文字贴进EditPlus的编辑窗口中,让你省去做贴上的步骤。另外它也是一个好用的HTML编辑器,除了可以颜色标记HTML
Tag (同时支持C/C++、Perl、Java)外,还内建完整的HTML和CSS1指令功能,对于习惯用记事本编辑网页的朋友,它可帮你节省一半以上的网页制作时间,
若你有安装IE 3.0以上版本,它还会结合IE浏览器于EditPlus窗口中,让你可以直接预览编辑好的网页(若没安装IE,也可指定浏览器路径)。
来自www.newhua.com
吉通站-->编辑软件
配置:tools-->configure user tools->files->setting &
syntax检查files extensions中是否有.php,template中是否增加menu text:php file
path:f:\editplus\template.php
而template.php可自行编辑,例如存放一些PHP公用的东西:
<? Php ?>,这样没new一个文件时都会自己出现<?php ?>格式。
Windows NT/2000/XP and IIS 4 or newer
To install PHP on an NT/2000/XP Server running IIS 4 or newer,
follow these instructions. You have two options to set up PHP,
using the CGI binary (php.exe) or with the ISAPI module.
In either case, you need to start the Microsoft Management Console
(may appear as 'Internet Services Manager', either in your Windows
NT 4.0 Option Pack branch or the Control Panel=>Administrative
Tools under Windows 2000/XP). Then right click on your Web server
node (this will most probably appear as 'Default Web Server'),
and select 'Properties'.
If you want to use the CGI binary, do the following:
· Under 'Home Directory', 'Virtual Directory', or 'Directory',
click on the 'Configuration' button, and then enter the App Mappings
tab.
· Click Add, and in the Executable box, type: c:\php\php.exe (assuming
that you have unziped PHP in c:\php\).
· In the Extension box, type the file name extension you want
associated with PHP scripts. Leave 'Method exclusions' blank,
and check the Script engine checkbox. You may also like to check
the 'check that file exists' box - for a small performance penalty,
IIS (or PWS) will check that the script file exists and sort out
authentication before firing up php. This means that you will
get sensible 404 style error messages instead of cgi errors complaing
that php did not output any data.
You must start over from the previous step for each extension
you want associated with PHP scripts. .php and .phtml are common,
although .php3 may be required for legacy applications.
· Set up the appropriate security. (This is done in Internet Service
Manager), and if your NT Server uses NTFS file system, add execute
rights for I_USR_ to the directory that contains php.exe.
To use the ISAPI module, do the following:
· If you don't want to perform HTTP Authentication using PHP,
you can (and should) skip this step. Under ISAPI Filters, add
a new ISAPI filter. Use PHP as the filter name, and supply a path
to the php4isapi.dll.
· Under 'Home Directory', click on the 'Configuration' button.
Add a new entry to the Application Mappings. Use the path to the
php4isapi.dll as the Executable, supply .php as the extension,
leave Method exclusions blank, and check the Script engine checkbox.
· Stop IIS completely (NET STOP iisadmin)
· Start IIS again (NET START w3svc)
User Contributed NotesServers-IIS/PWS
mortrr@gv.dk22-Jan-2001 09:08
To use php files with Visual InterDev (on IIS), add the php3 extionsion(and
others) to:[HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ VisualStudio\
6.0\ Editors\{C76D83F8-A489-11D0-8195-00A0C91BBEE3}\ Extensions]and
add PUT, DELETE as Method exclusions to the Application ConfigurationApp
mappings for .php3and check "Script Engine".
四、microsoft sql server 上函数的使用
1. 如何连接ms sql server,如何执行sql语句(查询、修改、添加、删除)?
用到如下函数:
mssql_connect()
mssql_close()
mssql_select_db()
mssql_query()
mssql_num_rows()
mssql_result()
mssql_num_fields()
mssql_field_name()
mssql_field_type()
mssql_field_length()
<?php
$server = "210.35.242.1";
$dbc = mssql_connect ("$server", "$username","$password")
or
DIE("服务器连接失败.");
/* 连接成功
if ($dbc){
}
*/
$dbName ="goodmanage";
mssql_select_db($dbName,$dbc) or DIE("打开数据库失败");
$query = "SELECT * FROM devicebelong";
//$query = "SELECT * FROM devicebelong where belong_code=$code+1";
//$query = "SELECT * FROM devicebelong where belong_code='$code'+'1'";字符串的连接
$query = "SELECT * FROM devicebelong where belong_code=$code";
$result = MSSQL_QUERY($query) or die ("数据查询失败");
$number = MSSQL_NUM_ROWS($result);
$number_fields = MSSQL_NUM_fields($result);
echo $number_fields;
$number_fieldname = MSSQL_field_name($result);
echo $number_fieldname;
$number_fieldtype = MSSQL_field_type($result);
echo $number_fieldtype;
$number_fieldlength = MSSQL_field_length($result);
echo $number_fieldlength;
$i=0;
if ($number == 0) :
print "No data?";
elseif ($number > 0) :
?>
<TABLE border=1 align=center>
<tr>
<td colspan=2 align=center>设备所属单位表</td>
</tr>
<TR>
<TD align=center>编号</TD>
<TD align=center>名称</TD>
</TR>
<?php
while ($i < $number) :
$code = mssql_result($result,$i,"belong_code");
$name = mssql_result($result,$i,"belong_Name");
?>
<TR>
<TD align=center><a href="default.php"><?=mssql_result($result,$i,"belong_code")?></a></TD>
<TD align=center><?=$name?></TD>
</TR>
<?php
$i++;
endwhile;
?>
</TABLE>
<?php
endif;
?>
<?php
/*表中数据的插入
$query = "insert into devicebelong values(6,'aa')";
$result = MSSQL_QUERY($query) or die ("数据插入失败");
*/
?>
<?php
/*表中数据的修改
$query = "update devicebelong set belong_name='bb' where
belong_code=6";
$result = MSSQL_QUERY($query) or die ("数据修改失败");
*/
?>
<?php
/*表中数据的删除
$query = "delete from devicebelong where belong_code=6";
$result = MSSQL_QUERY($query) or die ("数据删除失败");
*/
?>
<?php
mssql_close()
?>
|
|