谁会php转asp的呀,能否帮忙?

zhuangjunx 2010-08-26 11:33:41
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$res[$line['bihua']][] = array("id"=>$line['id'],"zi"=>$line['zi']);
}

php的这个方法 转成asp的是怎么做?

...全文
250 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
asp查询数据库,直接使用rs.getrows就是一个二维数组
所以你直接循环这个二维数组,就是类似php那样的了
rqrq 2010-08-28
  • 打赏
  • 举报
回复
vbs的数组只有编号索引,用js来实现吧。
zhuangjunx 2010-08-26
  • 打赏
  • 举报
回复
代码太多了,不好发,麻烦下载看看。

代码下载
zhuangjunx 2010-08-26
  • 打赏
  • 举报
回复
<?php
require('inc.php');

//每部首包含笔画数
$bpanum = array(0,8,37,81,133,162,192,216,231,242,248,255,260,262,264,267);

$zwnum = array("零","一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七");

$title = '新华字典';
if($_GET['q']){ //搜索
$q = htmlspecialchars(encodeStr(trim($_GET['q']),$code=1));
$zidianArr = getR($q);
$hotkey = hotkey();
$zidianStatus = 1;
}elseif($_GET['list']){ //列表
$lst = intval($_GET['list']);
if($lst>0 && $lst<=strlen($bpa)/3){
header("HTTP/1.1 301 Moved Permanently");
header('location: bushou_'.$lst.'.html');
}else{
header('location: ./');
}
exit;
}elseif($_GET['bushou']){ //部首列表
$lst = intval($_GET['bushou']);
if($lst=="-1"){
$bushou = "";
}elseif($lst>268){
header("HTTP/1.1 301 Moved Permanently");
header('location: ./bushou.html');
exit;
}elseif($lst==268){
$bushou = "难检字";
$zidianArr = lstBushou($lst);
}else{
$bushou = substr($bpa,$lst*3-3,3);
$zidianArr = lstBushou($lst);
}
$hotkey = hotkey();
$zidianStatus = 2;
}elseif($_GET['pinyin']){ //拼音列表
$lst = htmlspecialchars(strtolower($_GET['pinyin']));
if($lst=="index" || in_array($lst,$pya[strtoupper(substr($lst,0,1))])){
if($lst=="index"){
$pinyin = "";
}else{
$pinyin = $lst;
$zidianArr = lstPinyin($lst);
}

}else{
header("HTTP/1.1 301 Moved Permanently");
header('location: ./pinyin.html');
exit;
}
$hotkey = hotkey();
$zidianStatus = 3;
}elseif($_GET['id']){ //ID
$id = intval(base64_decode($_GET['id']));
//$id = $_GET['id'];
if($id<=0) header("location: ./");
$zidianArr = zidian($id);
if($zidianArr==false) header("location: ./");
$hotkey = hotkey($id."\t".$zidianArr['zi']);
$zidianStatus = 4;
}elseif($_GET['top']){ //笔画最多的汉字
$top = $_GET['top'];
$zidianArr = topzi($top);
$topstr = '笔画最多的汉字(前100个)';
$hotkey = hotkey();
$zidianStatus = 5;
}else{
$hotkey = hotkey();
$zidianStatus = 0;
}

function inPinyin($str){
global $pya;
foreach($pya as $value){
if(in_array($str,$value)) return true;
}
return false;
}

function getR($q,$t=0){ //搜索
global $tbname,$pya;

$sql .= 'select id,zi,bihua from '.$tbname.' where zi = "'.$q.'" or py like "%'.$q.'%" or zhengma = "'.$q.'" or sijiao = "'.$q.'" or wubi86 = "'.$q.'" or wubi98 = "'.$q.'" or cangjie = "'.$q.'" or bishun = "'.$q.'" or dianma = "'.$q.'" order by bihua limit 120';
$result = getlink($sql);
$totalNum = mysql_num_rows($result);
if($totalNum==0){
return false;
}elseif($totalNum==1){
$line = mysql_fetch_array($result, MYSQL_ASSOC);
header("location: ".base64_encode($line['id']).".html");
exit;
}
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$res[$line['bihua']][] = array("id"=>$line['id'],"zi"=>$line['zi']);
}
$res['total'] = $totalNum;

return $res;
}

function lstBushou($id){ //部首列表
global $bpa;
global $tbname;
$c = getArr("bs_".$id,1);
if($c!=false) return $c;

$pos = substr($bpa,$id*3-3,3);

if($pos==""){
$sql = 'select id,zi,buwai,pinyin from '.$tbname.' where bushou="-" or bushou="" order by buwai';
}else{
$sql = 'select id,zi,buwai,pinyin from '.$tbname.' where bushou="'.$pos.'" order by buwai';
}
$result = getlink($sql);
$totalNum = mysql_num_rows($result);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
if($line['pinyin']){
$line['pinyin'] =str_replace(array(" ","|"),array("",","),$line['pinyin']);
$line['pinyin'] = preg_replace('/\{\{(.*?)\}\}/',"",$line['pinyin']);
}
$res[$line['buwai']][] = array('id'=>$line['id'],"zi"=>$line['zi'],"pinyin"=>$line['pinyin']);
}
$res['total'] = $totalNum;

cacheArr("bs_".$id,$res,1);
return $res;
}

function lstPinyin($py){ //拼音列表
global $tbname;
$c = getArr("py_".$py,1);
if($c!=false) return $c;

$sql = 'select id,zi,bihua,pinyin from '.$tbname.' where py="'.$py.'" or py like "%|'.$py.'|%" or py like "'.$py.'|%" or py like "%|'.$py.'" order by bihua';
$result = getlink($sql);
$totalNum = mysql_num_rows($result);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
if($line['pinyin']){
$line['pinyin'] =str_replace(array(" ","|"),array("",","),$line['pinyin']);
$line['pinyin'] = preg_replace('/\{\{(.*?)\}\}/',"",$line['pinyin']);
}
$res[$line['bihua']][] = array('id'=>$line['id'],"zi"=>$line['zi'],"pinyin"=>$line['pinyin']);
}
$res['total'] = $totalNum;

cacheArr("py_".$py,$res,1);
return $res;
}

function topzi($t=1){ //汉字排行
global $tbname;
$c = getArr("top",1);
if($c!=false) return $c;

if($t==1){
$sql = 'select id,zi,bihua,pinyin from '.$tbname.' order by bihua desc limit 100';
}else{
return false;
}
$result = getlink($sql);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
if($line['pinyin']){
$line['pinyin'] =str_replace(array(" ","|"),array("",","),$line['pinyin']);
$line['pinyin'] = preg_replace('/\{\{(.*?)\}\}/',"",$line['pinyin']);
}
$res[] = $line;
}

cacheArr("top",$res,1);
return $res;
}

function zidian($id){ //某个ID
global $tbname;
$c = getArr($id);
if($c!=false) return $c;

$sql = 'select * from '.$tbname.' where id='.$id;
$result = getlink($sql);

$line = mysql_fetch_array($result, MYSQL_ASSOC);
if(!isset($line['zi'])) return false;

cacheArr($id,$line);
return $line;
}
zhuangjunx 2010-08-26
  • 打赏
  • 举报
回复
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$res[$line['bihua']][] = array("id"=>$line['id'],"zi"=>$line['zi']);
}

php的这个方法 转成asp的是怎么做?

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧