小编can*_*nim的帖子

Zend,Application.ini中的全局变量?

我有一个问题,因为我需要一个全局静态变量,我有问题是有可能将它添加到application.ini文件,该怎么做?

或者我必须:

  1. 用静态变量创建抽象类,
  2. 在Zend_Registry中注册它以从所有应用程序访问此变量(在Bootstrap文件中注册)
  3. 我可以使用它,或者更容易,我的意思是"自动方式"来做它?

谢谢你的建议!Regars,

zend-framework global-variables

8
推荐指数
4
解决办法
1万
查看次数

ZEND,使用数据呈现不同的视图

我有一个问题,因为我想从不同的控制器渲染视图并传递数据.你知道怎么做吗?

我在努力:

$this->renderScript('index/index.phtml')->entries = $result;
Run Code Online (Sandbox Code Playgroud)

但我的if:

if (count($this->entries) <= 0)
Run Code Online (Sandbox Code Playgroud)

返回0

你知道怎么做吗?谢谢!

rendering zend-framework view

7
推荐指数
1
解决办法
2万
查看次数

ZEND,编辑表格

我有一个Zend表单来向数据库添加内容.然后我想用这个表格来编辑我添加到数据库的内容.是否有可能使用此表单(从数据库填充并显示它?)我在我的控制器中有这个:

public function editAction() {

    if (Zend_Auth::getInstance()->hasIdentity()) {
        try {
            $form = new Application_Form_NewStory();
            $request = $this->getRequest();
            $story = new Application_Model_DbTable_Story();
            $result = $story->find($request->getParam('id'));

           // $values = array(
           //     'title' => $result->title,
           //     'story' => $result->story,
           // );

            if ($this->getRequest()->isPost()) {
                if ($form->isValid($request->getPost())) {
                    $data = array(
                        'title' => $form->getValue("title"),
                        'story' => $form->getValue("story"),
                    );
                    $where = array(
                        'id' => $request->getParam('id'),
                    );
                    $story->update($data, $where);
                }
            }
            $this->view->form = $form;
            $this->view->titleS= $result->title;
            $this->view->storyS= $result->story;
        } catch (Exception $e) {
            echo $e;
        } …
Run Code Online (Sandbox Code Playgroud)

zend-framework zend-form

5
推荐指数
1
解决办法
3383
查看次数

如何在服务器上部署和运行zend项目?

我有一个关于在服务器上部署Zend项目的问题.在localhost上,我使用虚拟主机将文档根目录设置为public/index.php文件夹.

  • 我该如何部署呢?我已经在服务器上复制了整个项目但由于我的所有路径都是错误的(因为所有路径都是相对于公共文件夹设置的)所以它不能正常工作.
  • 我该怎么办?是否可以在服务器上设置相对于我的主路径的所有路径?在这种情况下,如何将我的应用程序重定向到任何控制器?或者我可能只需要在服务器上创建虚拟主机,但我没有权限这样做:/?

我需要一些建议,谢谢


Application.ini:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"


resources.view[] =

resources.db.isDefaultTableAdapter = true
resources.db.adapter = PDO_MYSQL
resources.db.params.charset = "utf8"
resources.db.params.host = HOST
resources.db.params.username = "p"
resources.db.params.password = "***"
resources.db.params.dbname = "p"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = …
Run Code Online (Sandbox Code Playgroud)

php hosting zend-framework deploying

5
推荐指数
1
解决办法
1万
查看次数

计时器在动作脚本3中

我有问题,我需要创建计时器,但我想传递一个变量,如何做到这一点?AS3有可能吗?

我试过这样的:

            bonusPlayer1Timer = new Timer(5000);
            bonusPlayer1Timer.addEventListener(TimerEvent.TIMER, bonusChanges(player1));
            bonusPlayer1Timer.addEventListener(TimerEvent.TIMER_COMPLETE, bonusChangesRemove(player1));
            bonusPlayer1Timer.start();

function bonusChanges(event:TimerEvent, playerBonus:Player):void {
    switch (playerBonus.bonus) {
        case 0 :
            playerBonus.multipleShooting = false;
            playerBonus.bonus = -1;
            break;
...}}
Run Code Online (Sandbox Code Playgroud)

但我有错误:

1067: Implicit coercion of a value of type Player to an unrelated type flash.events:TimerEvent.
1136: Incorrect number of arguments.  Expected 2.
Run Code Online (Sandbox Code Playgroud)

而这个错误是粗线.

我可以这样使用它吗?或者我必须为每个玩家创建两个相同的函数,因为我不允许传递任何不同的参数来定时器函数?

谢谢,

actionscript actionscript-3 flash-cs3

2
推荐指数
1
解决办法
892
查看次数

ASP.NET MVC2自定义dateTime格式助手

我有一个关于如何创建自定义View Helpers的问题.我想在我的索引视图中更改我的默认日期时间格式.我想编写自己的Helper,因为我觉得它很容易就像PHP一样.我做了:

  1. 创建类:

    public static class CustomViewHelpers
    {
        public static MvcHtmlString returnDateString(string format, DateTime date)
        {
            return MvcHtmlString.Create(date.ToString(format));
        }
    }
    
    Run Code Online (Sandbox Code Playgroud)
  2. 我把它添加到web.config中,

  3. 我这样用过:

     <p><em>
        Birth date</em>
        <%: CustomViewHelpers.returnDateString("D", Model.Birth_Date); %></p>
    
    Run Code Online (Sandbox Code Playgroud)

但我总是得到错误:

编译错误

描述:编译服务此请求所需的资源时发生错误.请查看以下特定错误详细信息并相应地修改源代码.

编译器错误消息:CS1026 :)预期

但我认为这是一个错误的错误,因为当我删除我的线它正常工作,我看到有这些")"标记.你能解释一下为什么这种助手不起作用吗?也许你知道如何在ASP.NET MVC2中编写自己的帮助程序的好教程?

c# html-helper asp.net-mvc-2

2
推荐指数
1
解决办法
530
查看次数

Zend框架注册+电子邮件确认

你知道如何在Zend注册需要确认电子邮件吗?Zend有什么机制可以轻松完成吗?我发现只有发送电子邮件的课程,但我不知道Zend在注册过程中对电子邮件确认有特殊支持吗?

谢谢,

email zend-framework confirmation-email

0
推荐指数
1
解决办法
2051
查看次数