我的想法是编写一些脚本(cmd / unix)并在我的操作中调用它。我在谷歌搜索但我没有找到任何东西。我的想法是创建一个脚本(例如:我想调用这个脚本: cp file public / uploads )。
这是我的行动:
public function editAction()
{
//here i want to call my script
$id = (int) $this->params()->fromRoute('id', 0);
$article = $this->getObjectManager()->find('\Application\Entity\Article', $id);
if ($this->zfcUserAuthentication()->hasIdentity())
{
if ($this->request->isPost())
{
$article->setTitle($this->getRequest()->getPost('title'));
$article->setDate(new \DateTime($this->getRequest()->getPost('date')));
$article->setContent($this->getRequest()->getPost('content'));
$article->setPublication($this->getRequest()->getPost('publication'));
$article->getImage($id)->setUrl($this->getRequest()->getPost('path'));
$article->getImage($id)->setAlt($this->getRequest()->getPost('alt'));
$this->getObjectManager()->persist($article);
$this->getObjectManager()->flush();
return $this->redirect()->toRoute('blog');
}
}
else
{
return $this->redirect()->toRoute('user');
}
return new ViewModel(array('article' => $article));
}
因此,如果有人对此有任何想法,我将非常感激:)