DI我们有ServiceManager什么用途,用途是什么?
它们似乎与两者的配置文件类似zend-di,zend-servicemanager我们可以设置一些选项,如aliases和invokables.
我试图通过这些组件更好地了解幕后发生的事情,而且文档没有给我足够的信息.
你能否告诉我有什么区别,什么时候应该用Di而不是ServiceManager?
我想要做的是为注册用户添加更多属性(字段)以填写例如:我们有一个默认提供的显示名称,我希望有一些更像,出生地,出生日期等等..
我创建了自己的实体类,并使ZfcUser使用它(更具体地说:我添加了一些受保护的变量,getter和setter方法).
我的问题是,我真的不知道接下来该做什么.我知道我应该显然添加一些元素到表单,我可以做到但我怎么能"知道"zfcuser我在实体类中有更多的变量,所以它可以很好地使用数据库.
顺便说一句.我无法理解这个模块是如何工作的,例如它运行与数据库一起使用的脚本
哪一个编译器是对的?
class A
{
public:
template <typename T>
void fun(void (*f)() = funPrivate<T>) {}
private:
template <typename T>
static void funPrivate() {}
};
int main(int argc, char** argv)
{
A a;
a.fun<int>();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
编译正常:gcc版本4.8.5(Ubuntu 4.8.5-2ubuntu1~14.04.1)
导致错误:clang版本3.4-1ubuntu3(标签/ RELEASE_34/final)(基于LLVM 3.4)
a.cpp:5:27: error: 'funPrivate' is a private member of 'A'
void fun(void (*f)() = funPrivate<T>) {}
^~~~~~~~~~~~~
a.cpp:14:3: note: in instantiation of default function argument expression for 'fun<int>' required here
a.fun<int>();
^
a.cpp:8:16: note: declared private here
static void …Run Code Online (Sandbox Code Playgroud) 也许是明显的问题,但是请你告诉我如何在zend框架2中为标准视图助手创建的表单添加自定义CSS样式?
我试图将一些样式附加到ZfcUser创建的表单