我正在使用LiveDocx和zend框架从具有值的模板生成word文档。这是我在我的控制器做:file_put_contents权限被拒绝+ livedocx
public function createwordAction(){
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
require_once 'Zend/Service/LiveDocx/MailMerge.php';
try{
$filename = APPLICATION_PATH . "/../public/license-agreement-template.docx";
chmod($filename,0777);
$mailMerge = new Zend_Service_LiveDocx_MailMerge();
$mailMerge->setUsername('******')
->setPassword('*******');
$mailMerge->setLocalTemplate($filename);
$mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
->assign('licensee', 'Henry Döner-Meyer')
->assign('company', 'Co-Operation')
->assign('date', 'January 11, 2010')
->assign('time', 'January 11, 2010')
->assign('city', 'Berlin')
->assign('country', 'Germany');
$mailMerge->createDocument();
$document = $mailMerge->retrieveDocument('docx');
file_put_contents('document.docx', $document);
}
catch (Exception $e) {
die ('Application error: ' . $e->getMessage());
}
}
但我总是得到错误:
Warning: file_put_contents(document.docx): failed to open stream: Permission denied in /var/www/site/application/controllers/ResultsController.php on line 313
正如你可以看到我试着改变使用chmod文件权限,但没有做招...
我也试图改变公共文件夹的权限是这样的:
$path = APPLICATION_PATH . "/../public";
chmod($path,0777);
但相同的R- esult被赋予..
同样的结果...! – nielsv
您是否尝试过'chmod'公共目录? –
刚刚尝试过,结果相同。更新的开始帖子 – nielsv