0
我在phalcon模板有一些問題。它沒有像現在這樣渲染。這是一個行動方法的例子。稱爲UploadSave的操作。 並且在此操作之後,我想呈現圖像/上傳文件。phalcon設置視圖模板
try {
$hash = $this->request->getPost('hash');
$File = $this->_getUploadedFile();
$Validator = new ImageQualityValidator();
if($Validator->isValid($File)){
$Image = $this->_saveImage($File);
$EnvCfg = self::_getEnvCfgDir();
$cfg_data = $EnvCfg->getObject(self::MYPAINT);
$this->response->redirect($cfg_data->host.'image/crop?hash='.$hash);
}else {
$this->getViewData()->hash = $hash;
$this->getViewData()->validation_error = 'Image is invalid!!';
}
} catch (AMyPaintExceptions $Exc) {
$this->getViewData()->validation_error = $Exc->getMessage();
}
$this->view->setMainView('image/upload');
return $this->getViewData();
但結果是白色屏幕。 圖像/ upload.phtml不是空的:
{{
if(false == $this->is_already_image_uploaded) {
echo $Tag->form(
[
"image/uploadSave",
"method" => "post",
"enctype" => "multipart/form-data"
]
);
}}
<p> {{ echo $Tag->fileField('my_photo'); }}</p>
<p> {{ echo $Tag->hiddenField(["hash", "value" => $this->hash]); }}</p>
<p> {{ echo $Tag->submitButton('Submit'); }} </p>
{{ if($this->validation_error){ }}
<p>{{ print_r($this->error_information);}}</p>
{{ } }}
{{ echo $Tag->endForm(); }}
{{
}
else { }}
Image has been uploaded already.
{{ } }}
{{代替
請閱讀[文檔](https://docs.phalconphp.com/pl/latest/reference/volt.html)瞭解如何使用Volt模板語言。你的模板只是沿着模板編寫php,這就是我不會調試的。此外,您的帖子已損壞。 – yergo