简体   繁体   English

Zend Framework,从模型返回类方法

[英]Zend Framework, Returning class methods from model

I have a Model which I would like to use all variables in a drop down lis on a form. 我有一个模型,我想在表格的下拉列表中使用所有变量。

protected $_scheduledTime;
protected $_isLive;
protected $_isQueued;
protected $_url;

I was hoping, something like this would work, but it doesn't 我希望像这样的东西可以工作,但是不行

public function getMethods() {
    $methods = getclass_methods($this);
    return $methods;
}

Calling this returns this fatal error: 调用此命令将返回此致命错误:

Fatal error: Call to undefined function getclass_methods() 致命错误:调用未定义的函数getclass_methods()

What I want to achieve is an automatically updated form options when I update the model (which, could be quite frequently) 我要实现的是在更新模型时自动更新表单选项(这可能非常频繁)

I might have answered my own question, in that I would build an array in the model that returns upon a call... but if there is already a method that can do this, then it would be much appreciated. 我可能已经回答了我自己的问题,因为我会在模型中构建一个在调用后返回的数组...但是如果已经有一个方法可以做到这一点,那么将不胜感激。

Thank you in advance. 先感谢您。

get_declared_classes() // gives you all declared classes
get_class_methods() // gives you all methods of class
get_class_vars() // gives you properties of the class
get_object_vars() // gives you propertis of an object
get_parent_class()  // gives you parent class of the current class

函数是get_class_methods ,而不是getclass_methods(缺少“ _”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM