PHP
PHP 生成随机字符串<?phpfunctionRandomString($length=32,$type='number',$sa=''){$string='';switch($type){//纯小写英文字母,RandomString(32,'string')case'string':$sa='abcdefghijklmnopqrstuvwxyz';for($i=0;$i<$length;$i++){$string=$string.$sa[rand(0,25)];}unset($length,$type,$sa);break;//纯大写英文字母,RandomStri
24
ragnaroks
2016-11-27
PHP 中使用 cURL 实现 GET 和 POST 请求GET//初始化$curlInstance=curl_init();//设置选项,包括URLcurl_setopt($curlInstance,CURLOPT_URL,$targetURL);curl_setopt($curlInstance,CURLOPT_RETURNTRANSFER,1);curl_setopt($curlInstance,CURLOPT_HEADER,0);//执行并获取HTML文档内容$output=curl_exec($curlInstance);//释放curl句柄curl_close($curlInstance);
11
ragnaroks
2014-12-09
discuz 文章索引<?phpdefine('APPTYPEID',4);define('CURSCRIPT','sitemap');require'./source/class/class_core.php';$discuz=&discuz_core::instance();$discuz->cachelist=$cachelist;$discuz->init();$navtitle='站点标题';//网页标题$metakeywords='关键字';//网页关键词$metadescription='描述';//网页描述includetemplate('common
8
ragnaroks
2014-11-19
discuz 帖子索引<?phpdefine('APPTYPEID',4);define('CURSCRIPT','sitemap');require'./source/class/class_core.php';$discuz=&discuz_core::instance();$discuz->cachelist=$cachelist;$discuz->init();$navtitle='站点标题';$metakeywords='关键字';$metadescription='描述';includetemplate('common/header');echo'<sty
7
ragnaroks
2014-11-18