function genVeriCode(\$type,\$length=4,\$clear=true){
\$nums=range(0,9); // 数字数组
\$lower=range('a','z'); // 小写字母数组
\$upper=range('A','Z'); // 大写字母数组
\$ignore=array('0','o','O','1','l','I','9','q'); // 难辨认的字符数组

``````\$chars=array();
if(\$type==1)
\$chars=\$nums; // 只需要数字数组
elseif(\$type==2)
\$chars=array_merge(\$nums,\$lower); // 数字+小写字母
elseif(\$type==3)
\$chars=array_merge(\$nums,\$lower,\$upper); // 数字+小写字母+大写字母
if(\$clear)
\$chars=array_diff(\$chars,\$ignore); // 排除难辨认字符

\$keys=array_rand(\$chars,\$length); // 随机取出length个字符，返回它们的key
\$code="";
foreach(\$keys as \$key)
\$code.=\$chars[\$key]; // 通过key可以去\$chars中找到具体的值，并在循环中拼接起来

return \$code;
``````

}

1个回答

[code=C/C++]rnclass A rnrn public:rn void Hello(const std::string& name) rn rn std::cout << "hello " << name;rn rn;rnint main(int argc, char** argv)rnrn A* pa;rn pa->Hello("world");rn return 0;rnrn[/code]

for(int i=0;iControlCount;i++)//ScbMain是一个ScrollBox对象rn rn if(ScbMain->Controls[i]->ClassNameIs("Tonoff"))rn rn TOnOff * temp = dynamic_cast (ScbMain->Components[i]);//这句话出错代码是：List index out of bounds(1)rn if(temp)rn rn temp->DragKind=dkDrag; //设置控件为不可拖动rn temp->DragMode=dmManual;rn rn rn rnrn原代码是：

const char *hello()rnrn return "helkdjflkdjflkjsdflk";//这种写法有什么问题????????????rnrnvoid main()rnrn const char *p=hello();rn cout<

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;rn Shift: TShiftState);rnbeginrnif shift>=[ssShift] thenrn StatusBar1.Panels[0].Text:='Shift';rnrnif shift>=[ssAlt] thenrn StatusBar1.Panels[1].Text:='Alt';rnrnend;rn

rnrnrn rnrnrnrnrnrn rnrnrnrn

Sub Main()rn On Error GoTo errorhandlern rn systeminirn Dim mFrm As New MainFormrn ' mFrm.Showrn rn mFrm.SendXiaoLiangSmsrn rn Unload mFrmrnrn Set mFrm = Nothingrn rn Endrn rn Exit Sub '推出过程rn rnerrorhandle:rn ''MsgBox Err.source & " " & Err.Number & " " & Err.Description, vbInformation, "提示"rn ' MsgBox "请配置好 ini 文件 , 连接数据库 ! ", vbInformation, "提示"rn Exit SubrnEnd Sub

if ddlb_1.text="logout" thenrn exitwindowsex(0,0) rn if ddlb_1.text="restart" then rn exitwindowsex(2,0) elsern exitwindowsex(1,0)rn end if rnend ifrnrn提示有语法错误！
javaScript button的onclick调用函数没有反应？？
rnrn rn loginrnrn rnrnrn rn 用户名： rn rn 密码 ： rn 普通用户： rn 管理员： rn rn rn rnrnrn点击注册按钮时没有预期的反应，函数没有调用，希望高手给与解答，不胜感激！！

BOOL CPetWindowDlg::OnInitDialog()rnrn CDialog::OnInitDialog();rnrn // Set the icon for this dialog. The framework does this automaticallyrn // when the application's main window is not a dialogrn SetIcon(m_hIcon, TRUE); // Set big iconrn SetIcon(m_hIcon, FALSE); // Set small iconrn rn //得到最顶层的那个窗体的句柄rnrn HWND hwndTop=::GetTopWindow(NULL);rn RECT r;rnrnrn HDC cc=::GetDC(hwndTop);rn ::GetClientRect(hwndTop,&r); rnrn //在窗体上写字rn TextOut(cc, r.left, r.top, "Defenestration can be hazardous", 23); rnrnrnrn // TODO: Add extra initialization herern rn return TRUE; // return TRUE unless you set the focus to a controlrnrnrn没有写出字来rn

CPrintDialog pd(false);rnrn pd.GetDefaults();rnrn DEVMODE dev;rnrn DOCINFO doc;rn memset(&doc,0,sizeof(DOCINFO));rn doc.cbSize = sizeof(DOCINFO);rn doc.lpszDocName = "gflpower";rn doc.lpszOutput = (LPTSTR)NULL;//pd.GetPortName();rn dev = *pd.GetDevMode();rnrn CDC dc;rn dc.Attach(pd.CreatePrinterDC());rn if (dc == NULL) rn rn this->MessageBox("F");rn return;rn ;rnrn rn dc.StartDoc(&doc);rn dc.StartPage();rn dc.MoveTo(1,1);rn dc.LineTo(100,100);rn dc.TextOut(100,100,"GFJDKSLJFDKLSJF");rn dc.BitBlt(1,1,300,300,this->GetDC(),1,1,SRCCOPY);rn dc.EndPage();rn dc.AbortDoc();rn
php调用函数->和::有什么区别吗？？？
php调用函数->和::有什么区别吗？？？

◆◆◆为什么我播放Flash没有反应

Private Sub Form_Load()rn Dim arn Dim i As Longrn ReDim a(0, 14)rn For i = 1 To 14rn a(0, i) = irn Next irn ReDim Preserve a(1, 14)rn For i = 1 To 14rn a(1, i) = irn Next irnEnd Sub

String s = "v1";rnrs = sql.executeQuery("select * from project1 where ForeNumber = "+s);//vertices[i].start);rn-------------------------------------------rn提示是：rnrnjava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 参数不足，期待rn是 1。

[code=C#] DataSet ss = new DataSet();rn rn if (ss == null)rn _ppname = "";rn elsern _ppname = ss.Tables["cpxx"].Rows[0]["cplb"].ToString();[/code]rn这句话有问题吗 DATASET里没有信息 rnrn为什么这句话提示错误 _ppname = ss.Tables["cpxx"].Rows[0]["cplb"].ToString();rnrnSS里没有信息 不是应该执行第一句吗

select p.fisrespposition from T_ORG_Position p , T_PM_USER u, T_ORG_PositionMember mrnwhere p.fid=m.fpositionid and u.fid=m.fpersonid rnand u.fid='rhyVpxOXQmuu22PFNCRuDRO33n8='rnrnRT,怎么查不出来结果呢

rnrn rnrnrn rn rnrnrnrnrn我想点击"退出"按钮后,执行rnsession.abandon()rnresponse.redirect"index.asp"rn这两条语句.rn代码应该怎么写?

#include rn#include rn#include rn#include rn#include rnusing namespace std;rnint main()rnrn istream_iterator is(cin);rn istream_iterator eof;rn vector text;rn copy(is, eof, back_inserter(text));rn sort(text.begin(), text.end());rnrn ostream_iterator os(cout, “ ”);rn copy(text.begin(), text.end(), os);rn return 0;rnrn

#region 这种是以属性方式写的代码rn public string Heightrn rnrn get rn rn rn string height=null;rnrn DataSet ds = new DataSet();rnrn ds = item.GetLogeInfoById(LogeId);rnrn if (ds.Tables[0].Rows.Count> 0)rn rn if(ds.Tables[0].Rows[0]["LG_Hig_Nr"]!=null)rn rn height = Convert.ToString(ds.Tables[0].Rows[0]["LG_Hig_Nr"]);rn rn elsern rn height = "60";rn rn rn elsern rn height = "60";rn rnrn return height;rn rnrnrn rn #endregionrnrnrnrn #region 得到餐桌的高度(这种是以方法的形式写的代码)rnrn private void GetHeight() rn rn try rn rn DataSet ds = item.GetLogeInfoById(LogeId);rn if(ds.Tables[0].Rows.Count>0)rn rn if (ds.Tables[0].Rows[0]["LG_Hig_Nr"]!=null)rn rn height = ds.Tables[0].Rows[0]["LG_Hig_Nr"].ToString().Trim();rn rn rn rn catch(Exception ex)rn rn Response.Write(message.Alert(ex.Message));rn return;rn rn rnrn #endregionrn rn 我个人觉得是没有区别，只不过在调用的时候的一个是直接访问属性，一个是直接调用方法，可是现在关键是如果直接访问属性的时候得不到height的值，而我如果是直接调用方法就能得到height的值，昨天搞了半天都找出问题出在那里。大家帮帮忙！

<%rnid = Request("id")rnFor i = 1 to 1000rn response.write id&" "rnenxtrn%>rnrn<%rnFor i = 1 to 1000rn response.write Request("id")&" "rnenxtrn%>rnrn显示的结果当然没区别,但是效率呢?rn有没有比较科学的判别方法?

rn 年 rn rn 月 rn rn 日　*rnrnrn------------------------------------------------------------------rnrnrn " size="23" maxlength="20" /> rn *rnrnrn这两段代码放在一起会提示：rnMicrosoft VBScript 运行时错误 错误 '800a0009' rnrn下标越界: '[number: 0]' rnrnrnrn删其中任何一段都是正常的，不知道什么原因

Constructor constructor =Socket.class.getConstructor(new Class[] );rnSocket socket =(Socket) constructor.newInstance(new Object[] );rnrn和：rnSocket socket =new Socket();rnrn上面是jTDS的一段代码，我觉得上面两种效果一样啊，rn不知道为什么在jTDS里写成第一种形式

[code=JScript]var f=function g() return 23; ;[/code]rn与rn[code=JScript]var f=function() return 23; ;[/code]rnrn有区别吗？

●●●●●●●●●●●●●●●●●●●●●●●●●●●这两段精妙的代码 有什么区别吗？？？？？？？？
[code=JScript]var a=function()rn this.initialize.apply(this, arguments)rnrnvar b=function(x)rn a.prototype=xrn return arnrnrnvar aa=new b(rn initialize:function(name)rn this.name = name;rn rnrn)rnrnvar aaa=new aa("mike")rnalert(aaa.name)[/code]rnrnrn[code=JScript]var b=function(x)rn var a=function()rn this.initialize.apply(this, arguments)rnrn a.prototype=xrn return arnrnrnvar aa=new b(rn initialize:function(name)rn this.name = name;rn rnrn)rnrnvar aaa=new aa("mike")rnalert(aaa.name)[/code]rnrn其实就是一个把a函数放在里面 一个放在外面