我有两个模块,默认和管理员.虽然ZF确实正确加载了管理布局,但它始终只加载默认模块控制器和默认模块视图.
控制器的路径在module.ini文件中为每个模块指定.我也尝试在application.ini中指定它,如下所示:
admin.resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/admin/controllers"
Run Code Online (Sandbox Code Playgroud)
没有任何影响.任何可能出现问题的想法?在开始使用模块之前,我真的很喜欢ZF ..
我想上传一个通过Symfony2中的AJAX请求收到的文本文件(使用Uploadify 2.1.4).如何在动作中处理它?我在官方文档中找到了一些信息,但我想这不是我想要的.
例如,我以这种方式处理Zend Framework中的这种情况:
$adapter = new Zend_File_Transfer_Adapter_Http();
$adapter->setFilters(array(
'Rename' => array(
'target' => sprintf('%s/%d_%s', Zend_Registry::get('config')->uploads->uploadPath, time(), $adapter->getFileName(null, false), 'UTF-8'),
'overwrite' => true,
),
));
try
{
$adapter->receive();
}
catch (Zend_File_Transfer_Exception $e)
{
throw new Zend_Controller_Action_Exception(sprintf('Bad file: %s', $e->getMessage()));
}
Run Code Online (Sandbox Code Playgroud) 该手册的示例显示了如何仅为某些特定设置basePath viewModel:
$this->getHelper('basePath')->setBasePath()
Run Code Online (Sandbox Code Playgroud)
但我想在一个地方设置它,然后它在任何viewModel我在任何控制器中创建的都是相同的.我该怎么做?
伙计们,此时我已经接近开始拔头发了.我找不到实现这个目标的方法.
我有一个自定义类,属于我在WebServices Module src文件夹下创建的自定义文件夹.我需要能够从另一个模块/控制器内部实例化这个类,但是当我这样做并转储服务成员时,它包含null.如何从ApiAuthentication类中访问服务管理器.
任何帮助将不胜感激.谢谢
<?php
namespace WebServices\Services;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class ApiAuthenticationService extends \Zend\Soap\Client implements ServiceLocatorAwareInterface{
public $services;
function __construct($options = null){
parent::__construct('http://tinysoa.local/soap/security/api_authentication?wsdl',$options);
}
public function setServiceLocator(ServiceLocatorInterface $locator)
{
$this->services = $locator;
}
public function getServiceLocator()
{
return $this->services;
}
}
Run Code Online (Sandbox Code Playgroud)
当我从另一个模块/控制器内部调用它时,它转储一个空值:
class IndexController extends AbstractActionController
{
public function indexAction()
{
$a = new \WebServices\Services\ApiAuthenticationService();
var_dump($a->services);
Run Code Online (Sandbox Code Playgroud) 我刚刚使用Zend Framework 2创建了一个非常简单的单模块应用程序.
我已经设置了自动加载,路由等,但是当我尝试连接到这个测试应用程序时,我等待一些MINUTES,然后我找回一个空白页面.
apache错误日志说:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 33817602 bytes) in C:\Program Files\626Suite\application\library\Zend\ServiceManager\ServiceManager.php on line 339
Run Code Online (Sandbox Code Playgroud)
要么
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 49141298 bytes) in C:\Program Files\626Suite\application\library\Zend\ServiceManager\ServiceManager.php on line 301
Run Code Online (Sandbox Code Playgroud)
要么
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 179873796 bytes) in C:\Program Files\626Suite\application\library\Zend\ServiceManager\Di\DiServiceFactory.php on line 106
Run Code Online (Sandbox Code Playgroud)
但我真的无法理解这里出了什么问题,没有什么可以解释为一个简单的"hello world"控制器使用128MB的ram.
我也可以发布我的配置,如果它有用,就这么说.
有什么可能导致这个问题的想法?