本文整理汇总了PHP中ActionResponse::setHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionResponse::setHeader方法的具体用法?PHP ActionResponse::setHeader怎么用?PHP ActionResponse::setHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionResponse
的用法示例。
在下文中一共展示了ActionResponse::setHeader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
private function save(ProductFile $productFile)
{
$response = new ActionResponse();
$response->setHeader("Cache-Control", "no-cache, must-revalidate");
$response->setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
$validator = $this->buildValidator((int) $this->request->get('ID'));
if ($validator->isValid()) {
foreach ($this->application->getLanguageArray(true) as $lang) {
if ($this->request->isValueSet('title_' . $lang)) {
$productFile->setValueByLang('title', $lang, $this->request->get('title_' . $lang));
}
if ($this->request->isValueSet('description_' . $lang)) {
$productFile->setValueByLang('description', $lang, $this->request->get('description_' . $lang));
}
}
// Use title as description if no description was provided
$defaultLang = $this->application->getDefaultLanguageCode();
if (!$this->request->isValueSet('description_' . $defaultLang) || $this->request->get('description_' . $defaultLang) == '') {
$productFile->setValueByLang('description', $defaultLang, $this->request->get('title_' . $defaultLang));
}
$productFile->allowDownloadDays->set((int) $this->request->get('allowDownloadDays'));
$productFile->allowDownloadCount->set((int) $this->request->get('allowDownloadCount'));
$productFile->isEmbedded->set($this->request->get('isEmbedded') != false);
$productFile->isPublic->set($this->request->get('isPublic') != false);
$productFile->save();
$response->set('status', 'success');
$response->set('productFile', $productFile->toArray());
} else {
$response->set('status', 'failure');
$response->set('errors', $validator->getErrorList());
}
return $response;
}
示例2: index
public function index()
{
$this->loadLanguageFile('User');
$response = new ActionResponse('email', $this->request->get('email'));
$response->setHeader('NeedLogin', 1);
return $response;
}