0
내가 초보자 그리고 난 해골 하나에서 간단한 웹 응용 프로그램을 만드는 젠드 프레임 워크 웹 사이트에서 튜토리얼을 따라 갔다. 튜토리얼에서 제안한 폼에 추가 요소를 추가하려고합니다. 즉, '이미지'캡 시타를 적절히 렌더링하려고 시도하지만, 적절한 뷰에서 렌더링하려고하면이 치명적인 오류가 발생합니다.젠드 보안 문자 문제가
치명적인 오류 : 45 행의 C : \ xampp \ htdocs \ new \ vendor \ zendframework \ zendframework \ library \ Zend \ Form \ View \ Helper \ FormCaptcha.php의 정의되지 않은 메소드 Zend \ Form \ Element :: getCaptcha()를 호출하십시오.
이 뷰 내의 코드가<?php
namespace Album\Form;
use Zend\Form\Element;
use Zend\Form\Form;
use Zend\Captcha\Image;
use Zend\Captcha\AdapterInterface;
class AlbumForm extends Form
{
protected $captcha;
public function __construct($name = null)
{
// we want to ignore the name passed
parent::__construct('album');
$this->captcha = new Image(array(
'expiration' => '300',
'wordlen' => '7',
'font' => 'public/fonts/glyphicons-halflings-regular.tff',
'fontSize' => '20',
'imgDir' => 'public/captcha',
'imgUrl' => '/captcha'
));
$this->add(array(
'name' => 'id',
'type' => 'Hidden',
));
$this->add(array(
'name' => 'title',
'type' => 'Text',
'options' => array(
'label' => 'Title',
),
'attributes' => array(
'value' => 'Scrivi il titolo',
'class' => 'prova',
),
));
$this->add(array(
'name' => 'artist',
'type' => 'Text',
'options' => array(
'label' => 'Artist',
),
));
$this->add(array(
'name' => 'captcha',
'attributes' => array(
'type' => 'Captcha'
),
'options' => array(
'label' => 'Please verify you are human.',
'captcha' => $this->captcha
)
));
$this->add(array(
'name' => 'submit',
'type' => 'Submit',
'attributes' => array(
'value' => 'Go',
'id' => 'submitbutton',
),
));
}
}
입니다 :
이는 albumform 클래스에 관련된 코드
<?php
$form->setAttribute('action', $this->url('album', array('action' => 'add')));
$form->prepare();
echo $this->form()->openTag($form) . "\n";
echo $this->formHidden($form->get('id')) . "\n";
echo $this->formLabel($form->get('title')) . "\n";
?>
<br/>
<?php
echo $this->formInput($form->get('title')) . "\n";
?>
<br/><br/>
<?php
echo $this->formLabel($form->get('artist')) . "\n";
?>
<br/>
<?php
echo $this->formInput($form->get('artist')) . "\n";
?>
<br/><br/>
<?php
echo $this->formCaptcha($form->get('captcha')) . "\n";
echo $this->formSubmit($form->get('submit')) . "\n";
echo $this->form()->closeTag() . "\n";
?>
좀 도와 주시겠습니까? 없어진 물건 있어요?
감사합니다.
당신은 내가 대신 glyphicons-종족을-regular.ttf의 glyphicons - 종족을-regular.tff을 쓴 것을 깨달았다 동시에, 맞아. 이제 완벽하게 작동합니다. 고마워요! – Mitch85