dongmi5015 2014-08-03 16:16
浏览 31

试图开始使用Zend Framework 1.12.7

Hi guys I am having a lot of trouble getting started with Zend Framework 1.12. Basically I've managed to get my project set up in Netbeans and I have it located on my localhost. When I go to this URL I get the default page:

http://localhost/zendtest2/application/views/scripts/index/index.phtml

But when I go to this page I get a list of my file tree in the localhost directory

http://localhost/zendtest2/

I guess what I am trying to understand is how to I get the http://localhost/zendtest2/ to point to the http://localhost/zendtest2/application/views/scripts/index/index.phtml or is that how I would even do it?

I know there is a public folder in my project with an index.php file. Is there some way that I should be reaching that page when the project initially starts?

  • 写回答

1条回答 默认 最新

  • dongyong6428 2014-08-03 16:55
    关注

    To me this sounds more like an environment issue rather than a zend framework issue. I am not entirely sure what your dev environment is, but I am going to assume you're using apache as your HTTP server:

    https://wiki.apache.org/httpd/DirectoryListings

    Again, I am not entirely sure what OS you're using so you'll need to find your httpd.conf file yourself.

    You then have two options, adding the redirect/route there (that may be wrong) or (more recommended) uncommenting the httpd-vhosts.conf link:

    # Virtual hosts
    #Include /private/etc/apache2/extra/httpd-vhosts.conf
    

    Then including the new route in there. Heres a basic example (again you'll need to add what you need):

    <VirtualHost *:8888>
        ServerName zf2-tutorial.localhost
        DocumentRoot "/Users/stevenc/****DIR_STUFF****/skeleton-application/public"
    </VirtualHost>
    

    Anything beyond that can be set as your home route in the module.config.php of the Application module within your zend project:

    'router' => array(
        'routes' => array(
            'home' => array(
                'type' => 'Zend\Mvc\Router\Http\Literal',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller' => 'BookList\Controller\Book',
                        'action'     => 'index',
                    ),
                ),
            ),
    

    Also, if you're not using ZF 1.12 for any particular reason, ZF2.3* is the latest.

    评论

报告相同问题?

悬赏问题

  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序