將 html 頁面另存為 .php 文件即可; <?php ..... ..... ?> 標示不要忘記
我安装了Apache/ php,想调试下列PHP代码的效果 <? session_start(); if(!isset($count)) { session_register( "count"); $count = 1; } ?> You have been to this page <?=$count?> times <? $count++; ?> 我用FrontPage编程,并调试 <html><head> <meta http-equiv="Content-Type" content="text/html; charset=??????"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>New Page 34</title> </head><body> <? session_start(); if(!isset($count)) { session_register( "count"); $count = 1; } ?> You have been to this page <?=$count?> times <? $count++; ?> </body></html>然后打开http://localhost/new_page_34.htm.php,得到Warning: session_start(): open(/tmp\sess_d12a8bd008a8cb5981ec5aa7805c30af, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php on line 12Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php:11) in C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php on line 12Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php:11) in C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php on line 12 You have been to this page 1 times Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0Warning: Unknown(): open(/tmp\sess_d12a8bd008a8cb5981ec5aa7805c30af, O_RDWR) failed: No such file or directory (2) in Unknown on line 0Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 没有得到其效果 You have been to this page 6 times ,不知问题出在什么地方?是否是因为用FrontPage?还是我设置PHP运行环境出了问题?
<?php
.....
.....
?>
標示不要忘記
<?
session_start();
if(!isset($count)) {
session_register( "count");
$count = 1;
}
?>
You have been to this page <?=$count?> times
<?
$count++;
?>
我用FrontPage编程,并调试
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=??????">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 34</title>
</head><body>
<?
session_start();
if(!isset($count)) {
session_register( "count");
$count = 1;
}
?>
You have been to this page <?=$count?> times
<?
$count++;
?>
</body></html>然后打开http://localhost/new_page_34.htm.php,得到Warning: session_start(): open(/tmp\sess_d12a8bd008a8cb5981ec5aa7805c30af, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php on line 12Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php:11) in C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php on line 12Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php:11) in C:\Program Files\Apache Group\Apache2\htdocs\new_page_34.htm.php on line 12
You have been to this page 1 times
Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0Warning: Unknown(): open(/tmp\sess_d12a8bd008a8cb5981ec5aa7805c30af, O_RDWR) failed: No such file or directory (2) in Unknown on line 0Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
没有得到其效果
You have been to this page 6 times ,不知问题出在什么地方?是否是因为用FrontPage?还是我设置PHP运行环境出了问题?
但现在好像已经出来了让frontpage支php的插件,你可在phpe.net上搜索看看!
要放在开头"是指下面代码吗?
<?
session_start();
if(!isset($count)) {
session_register( "count");
$count = 1;
}
?>
用它做什么,用它可能还不如用一个文本编辑器
2.我将程序的头部
<?
session_start();
if(!isset($count)) {
session_register( "count");
$count = 1;
}
?>
放到放到开头,保存时它会跳转到体部<body>.
3.应该是头部要做一些改变,但不知改什么?或者是用FP支持PHP的插件,有那个知道?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=??????">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 34</title>
</head>
4.我已安装了Apache/php,此后修改了php.ini、Apache的配置文件后,是否都要重起动Apache服务器?