本文整理汇总了PHP中Zend\View\Model\JsonModel::getVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP JsonModel::getVariables方法的具体用法?PHP JsonModel::getVariables怎么用?PHP JsonModel::getVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\View\Model\JsonModel
的用法示例。
在下文中一共展示了JsonModel::getVariables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCanSerializeVariablesToJson
public function testCanSerializeVariablesToJson()
{
$array = array('foo' => 'bar');
$model = new JsonModel($array);
$this->assertEquals($array, $model->getVariables());
$this->assertEquals(Json::encode($array), $model->serialize());
}
示例2: folderPermissionsAction
public function folderPermissionsAction()
{
$jsonModel = new JsonModel();
foreach ($this->config['component'] as $component) {
if (@$component['image_path'] || @$component['video_path'] || @$component['file_path']) {
if (isset($component['image_path']) && !empty($component['image_path'])) {
if (!file_exists($component['image_path'])) {
$oldmask = umask(0);
mkdir($component['image_path'], 0777);
umask($oldmask);
$jsonModel->setVariable($component['image_path'], $component['image_path']);
}
}
if (isset($component['video_path']) && !empty($component['video_path'])) {
if (!file_exists($component['video_path'])) {
$oldmask = umask(0);
mkdir($component['video_path'], 0777);
umask($oldmask);
$jsonModel->setVariable($component['video_path'], $component['video_path']);
}
}
if (isset($component['file_path']) && !empty($component['file_path'])) {
if (!file_exists($component['file_path'])) {
$oldmask = umask(0);
mkdir($component['file_path'], 0777);
umask($oldmask);
$jsonModel->setVariable($component['file_path'], $component['file_path']);
}
}
}
}
$response = $this->getResponse();
$response->setContent(json_encode($jsonModel->getVariables()));
return $response;
}