在防機器人填寫垃圾表單除了Google套件外,如果要自行開發,最好的還是使用圖片文字來做為驗證依據,這裡分享一個不錯的GD圖形產生文字圖片的function分享給大家 php-code 可以吧以下這段function放到模組的function.php中 //產生GD文字圖片 function fonttoimageGDfunction($width="",$height="",$x="",$y="",$font_size="",$word=""){ //$width 區塊寬度 //$height區塊高度 //$x內容的x位置 //$y內容的y位置 //$font_size文字大小1~5(最大值為5) //$word顯示圖片文字內容 $im = imagecreatetruecolor($width, $height); //製作白底黑字 $text_color =imagefilledrectangle($im, 0, 0, 300, 300, imagecolorallocate($im, 255, 255, 255)); // 設定 底色白色 imagestring($im, $font_size, $x, $y, $word, $text_color); ob_start(); // 打開輸出控制緩衝 imagepng($im); $output = base64_encode(ob_get_clean()); //取得當前內容並刪除緩衝 imagedestroy($im); return $output; } 然後再要使用圖形驗的的地方輸出function //產生圖片 $word="text.text" echo $robottimedateingbox='<img id="fonttoimageGDbox" src="data:image/png;base64,'.fonttoimageGDfunction($width="100",$heig...