我想知道通过ZF2中的ServiceManager启动和重用logger实例的最佳方法是什么.当然,我可以在任何类中使用一种简单的方法,例如:
public function getLogger () {
$this->logger = new Logger();
$this->logger->addWriter(new Writer\Stream('/log/cms_errors.log'));
return $logger;
}
Run Code Online (Sandbox Code Playgroud)
但我想知道在global.php中注册类似结构的最佳方法是什么.到目前为止,我可以
将以下内容添加到global.php中
'Zend\Log'=>array(
'timestampFormat' => 'Y-m-d',
array(
'writerName' => 'Stream',
'writerParams' => array(
'stream' => '/log/zend.log',
),
'formatterName' => 'Simple',
),
),
Run Code Online (Sandbox Code Playgroud)
如果我尝试通过以下方式调用它:
$this->getServiceLocator()->get('Zend\Log')
Run Code Online (Sandbox Code Playgroud)
我得到一个:
Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for Zend\Log
Run Code Online (Sandbox Code Playgroud) 我需要找到一个javascript库,用于裁剪和调整适用于桌面和移动(触摸)设备的图像.它可能是一个jQuery插件,虽然我更喜欢有更多的香草.
我已经四处搜索并找到了各种选项,但它们似乎都只适用于桌面.
我目前正在进行的项目需要使用MIT和/或GPL许可的库.
我发现这个名为jQuery Image Crop的库(http://codecanyon.net/item/image-crop/5348464)正是我需要的,但不是在MIT/GPL许可下发布的.
有没有人对我有其他选择/建议?
谢谢
我正在尝试在CMS Plone中集成etherpad-lite,遵循官方文档http://etherpad.org/doc/v1.2.7/的示例1
Portal places the cookie "sessionID" with the given value on the client and creates an iframe including the pad.
Run Code Online (Sandbox Code Playgroud)
除了饼干之外,每件事都很顺利.阅读文档最好的实践似乎使etherpad-lite在特定路径下的同一域中.这就是我使用/ pad/path所做的.
Plone方面如果没有创建会话,我创建了,我添加了一个cookie然后我正在重定向到同一页面,以确保cookie在浏览器中.
结果,我的cookie被添加到主页面的请求中,但不是if iframe请求.
以下是主页面和iframe的Google Chrome控制台网络标签:
http://toutpt.makina-corpus.org/en/images/cookie-in-iframe/
对应于setCookie的代码位于https://github.com/toutpt/collective.etherpad/blob/master/collective/etherpad/archetypes.py#L100
我正在尝试data-在ZF2中的单选按钮上添加值.是否可以控制指定的每个输入value_options?
添加到表单的典型单选按钮:
$this->add(array(
'type' => 'radio',
'name' => 'duration',
'options' => array(
'value_options' => array(
'daily' => 'Daily',
'weekly' => 'Weekly',
'monthly' => 'Monthly',
),
),
));
Run Code Online (Sandbox Code Playgroud)
最后,我想要以下内容,因此我可以为每个电台项目指定单独的参数/选项:
$this->add(array(
'type' => 'radio',
'name' => 'duration',
'options' => array(
'value_options' => array(
array(
'attributes' => array(
'value' => 'daily',
'data-item' => 'apple'
),
'options' => array(
'label' => 'Daily'
)
),
array(
'attributes' => array(
'value' => 'weekly',
'data-item' => 'orange'
),
'options' => array(
'label' => …Run Code Online (Sandbox Code Playgroud)