<?
//t01.php
class test
{
var $p1;
var $p2;
}
?>
//////////////////////////////////////////
<?
session_start();
session_register("ses_Test");
//t02.php
require("t01.php");
$aTest = new test;
$aTest->p1 = "p1";
$aTest->p2 = "p2";
echo $aTest->p1;
echo $aTest->p2;
$ses_Test = $aTest;
?>
<A HREF="t03.php">t03.php</A>
//////////////////////////////////////////
<?
session_start();
//t03.php
echo $ses_Test->p1;
echo $ses_Test->p2;
?>
//////////////////////////////////////////
这是在ie中浏览到t03.php时的效果:Fatal error: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition test of the object you are trying to operate on was loaded _before_ the session was started in d:\apache group\apache\htdocs\\t03.php on line 3
//t01.php
class test
{
var $p1;
var $p2;
}
?>
//////////////////////////////////////////
<?
session_start();
session_register("ses_Test");
//t02.php
require("t01.php");
$aTest = new test;
$aTest->p1 = "p1";
$aTest->p2 = "p2";
echo $aTest->p1;
echo $aTest->p2;
$ses_Test = $aTest;
?>
<A HREF="t03.php">t03.php</A>
//////////////////////////////////////////
<?
session_start();
//t03.php
echo $ses_Test->p1;
echo $ses_Test->p2;
?>
//////////////////////////////////////////
这是在ie中浏览到t03.php时的效果:Fatal error: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition test of the object you are trying to operate on was loaded _before_ the session was started in d:\apache group\apache\htdocs\\t03.php on line 3
解决方案 »
- 头晕,这样配置zendframework为什么不行
- php中自动下载文件到指定的系统目录中
- 问一下PHP://input怎么传给simplexml
- 求对数组的递归代码
- 庆贺xizi2002成星,哈哈,散分~~~~~~~
- 谁来帮我一把~~~~~~~~~~~~~~~~~~~~~~!!!!!!!!!!!!!
- 请问大家“PHP中表单变量如何传递?”(谢谢指教)
- MYSQL在那里管理啊~~~~
- Parse error: syntax error, unexpected '<' in ..\syclasstype.php on line 91,怎么解决
- 稍微改一下就完美了 php显示目录文件
- 向高手请教一个很简单的连接问题,我真的是黔驴技穷了
- ———子窗口提交后如何传递参数给父窗口———
我说的就是你这种思路
我自己的测试也是一样的结果!
那也就是说这样行不通了??你没有没试过可以做到相似效果的方法!
使多个页面共用一个连接对象,来访问mysql!
提高速度~??????加到100分!欢迎大家参于讨论,给小弟讲了经验
session_start();
session_register("ses_conn");
//t01.php
$conn = mysql_connect("localhost","","");
echo $conn;
$ses_conn = $conn;
?>
<A HREF="t02.php">t02.php</A>
////////////////////////////////////////////////////////
<?
session_start();
//t02.php
echo $ses_conn;
echo "<br>";
echo mysql_select_db("glasscity");
echo "<br>";
$sql = "select * from User";
$res = mysql_query($sql);
echo $res;
echo "<br>";
echo mysql_num_rows($res);
echo "<br>";
?>
///////////////////////////////////////////////
以下是IE中的结果:
0
1
Resource id #2
2