本文整理匯總了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;
}