如何获取我所使用的方法的名称。 [英] How do I get the name of the method I am in.

查看:68
本文介绍了如何获取我所使用的方法的名称。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


所以get_class($ this)将返回我的班级名称,我如何获得该方法的名称?


谢谢Purple ..

解决方案

这个)会返回我的班级名称,我怎么得到方法的名字?


谢谢Purple ..


试试这个:

展开 | 选择 | 换行 | 行号


< blockquote>感谢你的响应ajaxrand但它没有..


使用你的代码:


[PHP]<?php

class _Cl屁股{

函数myfunc1(){

do_function_that_errors()

或死(类中的错误。 get_class()。 "方法方法名称here());

返回(true);

}

函数myfunc2(){

返回(true);

}


}


Hi all,

So get_class($this) will return my class name, how do I get the name of the method ?

Thanks Purple..

解决方案

this) will return my class name, how do I get the name of the method ?

Thanks Purple..


Try this:

Expand|Select|Wrap|Line Numbers


Thanks for the response ajaxrand but it didn''t..

Using your code:

[PHP]<?php
class _Class{
function myfunc1(){
do_function_that_errors()
or die("error in class ". get_class(). " method ". Method name here() );
return(true);
}
function myfunc2(){
return(true);
}

}


这篇关于如何获取我所使用的方法的名称。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆