我正在使用PFBC一个由谷歌提供的软件包来创建我的表单,因为我是php新手,我有一个项目我需要快速完成,无论如何我只是想把Capacha块放在我的div中间我知道我必须用css中的风格连接它我只是不知道如何将它添加到我的PHP中
这是Capatcha.php文件,所有元素都在单独的php文件中分解
<?php
namespace PFBC\Element;
class Captcha extends \PFBC\Element {
protected $privateKey = "";
protected $publicKey = "";
public function __construct($label = "", array $properties = null) {
parent::__construct($label, "recaptcha_response_field", $properties);
}
public function render() {
$this->validation[] = new \PFBC\Validation\Captcha($this->privateKey);
require_once(__DIR__ . "/../Resources/recaptchalib.php");
echo recaptcha_get_html($this->publicKey);
}
}
这就是渲染的方式
// reCAPTCHA with validation, automaticallly required
$form->addElement(new Element\Captcha("Validation:", array(
"longDesc" => "This is a <a href=\"http://en.wikipedia.org/wiki/ReCAPTCHA\">
reCaptcha test</a> to reduce spam submissions.",
)));