请问要触发这个file_get_content 给一下解题思路也好....
问题描述
<?php
highlight_file(__FILE__);
error_reporting(0);
class Game{
public $username;
public $password;
public $choice;
public $register;
public $file;
public $filename;
public $content;
public function __construct()
{
$this->username='user';
$this->password='user';
}
public function __wakeup(){
if(($this->register)==="admin"){
$this->choice=new login($this->file,$this->filename,$this->content);
}else{
$this->choice = new register();
}
}
public function __destruct() {
$this->choice->checking($this->username,$this->password);
}
}
class login{
public $file;
public $filename;
public $content;
public function __construct($file,$filename,$content)
{
$this->file=$file;
$this->filename=$filename;
$this->content=$content;
}
public function checking($username,$password)
{
if($username==='admin'&&$password==='admin'){
$this->file->open($this->filename,$this->content);
die('login success you can to open shell file!');
}
}
}
class register{
public function checking($username,$password)
{
if($username==='admin'&&$password==='admin'){
die('success register admin');
}else{
die('please register admin ');
}
}
}
class Open{
function open($filename, $content){
echo file_get_contents($filename);
}
}
@unserialize(base64_decode($_POST['unser']));
}
这是老师发的一个题目,因为PHP学习还没有那么深入,所以希望能有一个解题思路
问题解答
回答1:问题不够详情。
file_get_contents() 函数把整个文件读入一个字符串中。
这个可以抓取数据,不过现在curl的功能更好。
相关文章:
1. Mac环境下QT编译MySQL驱动屡次失败?如何?2. javascript - 怎么实现让 div 里面的 img 元素 中心居中, 如下示例图3. javascript - 移动端一个小效果4. 微信开放平台 - ios APP能不能打开微信然后通过微信跳转到指定的URL?5. javascript - vue引入样式的问题6. thinkphp5.1学习时遇到session问题7. php - 微信开发验证服务器有效性8. Android下,rxJava+retrofit 并发上传文件和串行上传文件的效率为什么差不多?9. javascript - vue+iview upload传参失败 跨域问题后台已经解决 仍然报403,这是怎么回事啊?10. javascript - nodejs调用qiniu的第三方资源抓取,返回401 bad token,为什么
