請問要觸發這個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. html5 - 有可以一次性把所有 css外部樣式轉為html標簽內style=" "的方法嗎?2. javascript - 求解答:實例對象調用constructor,此時constructor內的this的指向?3. javascript - 如何將一個div始終固定在某個位置;無論屏幕和分辨率怎么變化;div位置始終不變4. javascript - 這不是對象字面量函數嗎?為什么要new初始化?5. javascript - vscode alt+shift+f 格式化js代碼,通不過eslint的代碼風格檢查怎么辦。。。6. html - vue項目中用到了elementUI問題7. javascript - 有什么比較好的網頁版shell前端組件?8. javascript - iframe 為什么加載網頁的時候滾動條這樣顯示?9. javascript - [js]為什么畫布里不出現圖片呢?在線等10. javascript - 原生canvas中如何獲取到觸摸事件的canvas內坐標?
