未调用PHP析构函数
我使用的是PHP5.4.12 我有两节课未调用PHP析构函数,php,Php,我使用的是PHP5.4.12 我有两节课 <?php class MySessionHandler implements SessionHandlerInterface { //.. } $handler = new MySessionHandler(); session_set_save_handler($handler,true); ?> 及 在上述情况下,您需要实例化对象: $test = new MySession(); 不要依赖于\u自毁…: 当使用对象作为会
<?php
class MySessionHandler implements SessionHandlerInterface {
//..
}
$handler = new MySessionHandler();
session_set_save_handler($handler,true);
?>
及
在上述情况下,您需要实例化对象:
$test = new MySession();
不要依赖于\u自毁…:
当使用对象作为会话保存处理程序时,向PHP注册shutdown函数非常重要,以避免PHP在关闭时内部销毁对象的方式产生意外的副作用,并可能阻止调用write和close。通常,您应该使用register\u shutdown\u function()函数注册“会话写入关闭”
见马歇尔的回答。MySession是一个类而不是一个函数
<?php
require_once 'MySessionHandler.php';
include_once 'MySession.php';
$test = new MySession();
<?php
require_once 'MySessionHandler.php';
include_once 'MySession.php';
class Test {
function __construct() {
$test = new MySession();
}
}
$obj = new Test();
$test = new MySession();