我无法找到相当于此的东西
http://framework.zend.com/manual/1.12/en/zend.service.amazon.s3.html
在2.0版本的文档中.我还注意到2.0最小版本是2.5MB,而1.12最小版本是8.7MB,完整的1.12版本是~30MB.
我已经和Zend Framework 2合作了几个星期了,即使在线文档非常不完整,我还是设法建立了我网站的初稿.
不幸的是,我在尝试实现Zend\Filter\File\Rename过滤器的自定义版本时遇到困难; 在这里,我总结一下我做过的事情:
1)在我的名为"Library"的模块中,创建了该文件
SRC \图书馆\过滤器\文件\ Rename.php
namespace Library\Filter\File;
use Traversable;
use Zend\Filter;
use Zend\Filter\Exception;
use Zend\Stdlib\ArrayUtils;
class Rename extends Filter\AbstractFilter {
static $uploadDir = '/srv/default/htdocs/public/uploads/';
public function filter($value) {
do {
$newname = md5(uniqid(time()));
} while(file_exists(self::uploadDir . $newname);
if (rename($value, self::uploadDir . $newname) !== true)
throw new Exception\RuntimeException(sprintf("File '%s' could not be renamed. An error occurred while processing the file.", $value));
return self::uploadDir . $newname;
}
}
Run Code Online (Sandbox Code Playgroud)
如您所见,非常简单.这是模块配置:
module.config.php
<?php
return array(
'controllers' => array(
// Invokables …Run Code Online (Sandbox Code Playgroud) 我正在尝试将一个选择框添加到我的一个表单中(只是输入类型="文本"元素工作得很好)但我得到的只是一个没有标签的空选择框.所以这是我使用的代码:
Bla.php :: Bla-> getInputFilter()
$inputFilter->add($factory->createInput(array(
'type' => 'Zend\InputFilter\Select',
'name' => 'payment_type',
'required' => true,
'filters' => array(
array('name' => 'Int'),
),
)));
Run Code Online (Sandbox Code Playgroud)
BlaForm.php :: BlaForm - > __ construct():
$this->add(array(
'type' => 'Zend\Form\Element\Select',
'name' => 'payment_type',
'options' => array(
'label' => 'Payment',
'value_options' => array(
0 => 'Nur Überweisung',
1 => 'Nur Paypal',
2 => 'Nur Barzahlung im Voraus',
),
),
'attributes' => array(
'value' => 0 //set selected to "Nur Überweisung"
)
));
Run Code Online (Sandbox Code Playgroud)
bla.php(查看)
<div class="control-group">
<?php
echo …Run Code Online (Sandbox Code Playgroud) 我只是找不到答案......有没有办法把答案传给CSS class我open-form-tag?
例如,我想创建一个类"'form-horizontal''的表单.
文档说这个:
// Render the opening tag
echo $this->form()->openTag($form);
// <form action="/contact/process" method="post">
Run Code Online (Sandbox Code Playgroud)
但是如何添加表单类名?
编辑:我尝试将此添加到我的Form.php但没有发生任何事情......
public function getOptions()
{
return array('class' => 'form-horizontal');
}
Run Code Online (Sandbox Code Playgroud)
谢谢,
罗恩
因为我的连接包括一个名为"id"的字段,所以我需要在我的sql期间重命名这个字段名,这样它就不会覆盖我从第一个选中的tabel中的id字段名.
我的查询看起来如下;
$select = new \Zend\Db\Sql\Select();
$select->from('websites');
$select->join(array('s' => 'websites_statistics'), 's.website_id = websites.id');
$select->where(array('websites.website' => $website));
$select->order('s.timestamp DESC')->limit(1);
$rowset = $this->tableGateway->selectWith($select);
$row = $rowset->current();
return $row;
Run Code Online (Sandbox Code Playgroud)
因此,'s''id'字段应该重命名为'stat_id'.
提前致谢!
缺口
我正在创建注册表单:
这是我的行动:
public function registrationAction() {
$form = new RegistrationForm();
$request = $this->getRequest();
if ($request->isPost()) {
$users = new Users();
$form->setInputFilter($users->getInputFilter());
$form->setData($request->getPost());
var_dump($form->isValid());
exit;
if ($form->isValid()) {
$users->exchangeArray($form->getData());
$this->getUsersTable()->addUser($users);
$message = '????????????? ?? ???????! ?????? ?? ??????? ? ??????? ?? ???? ??????? ?? ???? ?? ????????? ????????.';
}
}
return new ViewModel(array(
'form' => $form,
'message' => $message,
));
}
Run Code Online (Sandbox Code Playgroud)
这是我的表格:
namespace Main\Form;
use Zend\Form\Form;
class RegistrationForm extends Form {
public function __construct($name = null) {
parent::__construct('User');
$this->add(array(
'name' => …Run Code Online (Sandbox Code Playgroud) 我有一个styles.css文件,我需要从 a 加载它cljs以将它作为 aprops传递给反应库。
节点中的导入是:
import styles from './styles.css'
是否可以在 ClojureScript 中使用shadow-cljs?
我正在忙于编写数据库会话模块,因此我可以在多个应用程序之间快速安装它.该模块将作为要启动的第一个模块从自动装载器加载.我想要完成的是将默认会话容器/会话处理程序更改为所有模块的默认会话处理程序,它也应该是数据库托管会话.我已经与zf2会话处理程序争论了很长一段时间,并且日志中的错误有意义.所以我到目前为止所拥有的.Module.php的基本模块包含...
命名空间DBSession;
use Zend\Mvc\ModuleRouteListener;
class Module {
public function onBootstrap($e) {
$e->getApplication()->getServiceManager()->get('translator');
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
$config = $e->getApplication()->getServiceManager()->get('Config');
$controller = $e->getTarget();
$controller->config = $config;
new \DBSession\Storage\DBStorage();
}
public function getConfig() {
return include __DIR__ . '/config/module.config.php';
}
public function getAutoloaderConfig() {
return array(
'Zend\Loader\ClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php',
),
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
以及启动数据库会话处理程序的实际类.
namespace DBSession\Storage;
use Zend\Session\SaveHandler\DbTableGateway;
use Zend\Session\SaveHandler\DbTableGatewayOptions; …Run Code Online (Sandbox Code Playgroud) 如何在ZF 2中的控制器中调用basePath助手.我必须重定向到我需要基本路径的特定URL.return $ this-> redirect() - > toUrl($ basePath.'/ application/rent/search');
我有EdpModuleLayouts模块的问题.我将Module.php放在module/EdpModuleLayouts /目录中,其中包含以下内容:
<?php
namespace EdpModuleLayouts;
class Module {
public function onBootstrap($e) {
$e->getApplication()->getEventManager()->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch', function($e) {
$controller = $e->getTarget();
$controllerClass = get_class($controller);
$moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\'));
$config = $e->getApplication()->getServiceManager()->get('config');
if (isset($config['module_layouts'][$moduleNamespace])) {
$controller->layout($config['module_layouts'][$moduleNamespace]);
}
}, 100);
}
}
Run Code Online (Sandbox Code Playgroud)
我还在config/application.config.php中注册了它:
return array(
'modules' => array(
'EdpModuleLayouts',
'Main',
'Administrator',
'Object'
),
'module_layouts' => array(
'Main' => 'layout/main',
'Administrator' => 'layout/admin',
),
'module_listener_options' => array(
'module_paths' => array(
'./module',
),
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
),
);
Run Code Online (Sandbox Code Playgroud)
"main"模块的配置如下所示:
<?php
return array( …Run Code Online (Sandbox Code Playgroud)