我有这样的PHP代码:
if(DEBUG){
g_start = new Date().getTime();
console.log("start graph render: " + g_start );
}
var data_ajax = [{
"color" : "#A8B400",
"label" : "R1 Graph",
"lines" : {
"show" : true,
"lineWidth" : 1
},
"points" : {
"show" : false
},
"yaxes" : 1,
"data" : arr,
animator: { start: 100, steps: 99, duration: 1000, direction: "left" }
}
];
$('#network-graph').empty();
//plot = $.plotAnimator($("#network-graph"), data_ajax, options);
plot = $.plot("#network-graph", data_ajax, options);
bind();
if(DEBUG){
g_end = new Date().getTime();
console.log("finish graph render: " + g_end );
console.log("process graph render duration : " + ((g_end - g_start)/1000) + "s" );
}
正如您在代码评论中看到的那样,我需要class class_name
{
public function function_name()
{
/** I need to "class_name" and "function_name" in here
* How can I get them?
*/
}
}
和class_name
。我怎么能得到它们?我认为function_name
可以获得课程的名称。但实际上我的主要问题是获得方法的名称......
答案 0 :(得分:2)
根据评论:
class class_name
{
public function function_name()
{
echo __CLASS__; // output: class_name
echo __FUNCTION__; // output: function_name
}
}
但是,为了获得这两者,你必须使用返回__METHOD__
的{{1}}。