PHP验证码使用纯文本(PHP captcha using plain text)
这是我第一次在这里发帖,因为这也是我第一次决定从头开始为自己建立一个网站。 我正在创建一个带有基本验证码脚本的联系页面。 由于您可能认为疯狂的原因,我想将验证码显示为文本。 我决定反对png,因为(反)别名是非常糟糕的透明背景,我不认为我的网站会引起太多不必要的注意。
这是我的captcha.php
<?php session_start(); $characters_on_image = 4; $possible_letters = '0123456789'; $code = ''; $i = 0; while ($i < $characters_on_image) { $code .= substr($possible_letters, mt_rand(0, strlen($possible_letters)-1), 1); $i++; } echo $code; header('Content-Type: text/plain'); $_SESSION['code'] = $code; ?>
我遇到的问题是,如果我使用
<?php print $_SESSION['code']; ?>
<?php print $_SESSION['code']; ?>
它会打印上一个代码。 我的编程非常复杂,我想知道是否有办法在<label>
标签中显示当前生成的代码?It's my first time posting here as it's also the first time I've decided to build a site from scratch for myself. I'm creating a contact page with a basic captcha script. For reasons you might think are crazy, I want to display the captcha as text. I decided against png as the (anti)aliasing was pretty bad with a transparent background and I don't think my site is going to cause too much unwanted attention yet.
Here is my captcha.php
<?php session_start(); $characters_on_image = 4; $possible_letters = '0123456789'; $code = ''; $i = 0; while ($i < $characters_on_image) { $code .= substr($possible_letters, mt_rand(0, strlen($possible_letters)-1), 1); $i++; } echo $code; header('Content-Type: text/plain'); $_SESSION['code'] = $code; ?>
The problem I'm having is that if I use
<?php print $_SESSION['code']; ?>
it will print the previous code. My programming is pretty ropey and I was wondering if there is a way to show the current generated code in a<label>
tag?
原文:https://stackoverflow.com/questions/10147721
满意答案
将任何属性传播到所有UI对象的最快和最干净的方法是使用
findobj
:set(findobj('Type','uicontrol'), 'BusyAction','cancel', 'Interruptible','off');
The fastest and cleanest way to propagate any property to all UI objects is with
findobj
:set(findobj('Type','uicontrol'), 'BusyAction','cancel', 'Interruptible','off');
相关问答
更多MATLAB:GUI按钮调用函数.m(MATLAB : GUI pushbutton call function .m)
Matlab GUI回调开始和完成(Matlab GUI Callback Start and Completion)
matlab gui - 同样的gui屏幕(matlab gui - callling the same gui screen)
在MATLAB中在函数和回调之间传递数据(Passing data between functions and callbacks in MATLAB)
Matlab匿名回调函数参数(Matlab anonymous callback function arguments)
在GUI matlab中运行函数(Running Functions in GUI matlab)
Matlab Gui:如何在函数之间共享数据(Matlab Gui: how to share datas among functions)
避免在Matlab GUI中中断回调函数(Avoid interruption of callback functions in Matlab GUI)
matlab GUI回调(matlab GUI callback)
如何在Matlab中运行GUI之外的按钮回调?(How to run pushbutton callback outside of GUI in Matlab?)
相关文章
更多简单验证码生成——Java版
jsp 验证码刷新无反应 怎么回事
网络挖掘技术——text mining
java.text.DecimalFormat 的问题
my php & mysql FAQ
微信验证码
企业级搜索引擎Solr 第二章 Schema和文本分析(Schema and Text Analysis)[2]
PHP简介
请教怎么在CAS中添加验证码功能
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!