Fatal error: Class 'Zend\Form\Element' not

2019-08-16 16:37发布

In my webapp/index.php I have defined the include_path as shown below:

<?php
    set_include_path(implode(PATH_SEPARATOR, array(
        'C:\Program Files\NetBeans 7.1.2\php\library',
        get_include_path()
    )));
    require_once 'Zend\Form\Fieldset.php';
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
       <?php
            #do something with Fieldset class;
       ?>
    </body>
</html>

But I keep on getting this error message when I run the file:

 Fatal error: Class 'Zend\Form\Element' not found in C:\Program Files\NetBeans 7.1.2\php\library\Zend\Form\Fieldset.php

Thanks for your help.

1条回答
霸刀☆藐视天下
2楼-- · 2019-08-16 17:26

I never tried to use zf like that (out of its mvc) but I would guess you need to setup the autoloader so that Zend can find its different classes.

Typically Zend's autoloader will look for class Zend_Form_Element_Text in \Zend\Form\Element\Text.php

Have a look at the documentation

查看更多
登录 后发表回答