日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > php >内容正文

php

bytestobstr php,一段asp转php

發(fā)布時(shí)間:2024/3/26 php 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 bytestobstr php,一段asp转php 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

版權(quán)聲明:原創(chuàng)作品,允許轉(zhuǎn)載,轉(zhuǎn)載時(shí)請(qǐng)務(wù)必以超鏈接形式標(biāo)明文章原始出版、作者信息和本聲明。否則將追究法律責(zé)任。

http://blog.csdn.net/mayongzhan - 馬永占,myz,mayongzhan

程序是共通的...

下面是asp轉(zhuǎn)php的代碼

雖然有的地方不太清楚.基本上還是可以看出.任何語(yǔ)言都是可以互相轉(zhuǎn)換的.

上面是php下面是asp

//-------------------------------------------------------------------------------------

class clsThief

{

//__________________

private $value_;

private $src_;

private $isGet_;

public function setSrc($str)

{

$this->src_ = $str;

}

public function getSrc()

{

return $this->src_;

}

public function getValue()

{

return $this->value_;

}

public function getVersion()

{

return "Version 2005";

}

function __construct()

{

$this->value_ = "";

$this->$src_ = "";

$this->isGet_ = false;

}

function __construct()

{

//construct

}

public function bytesToBstr($body,$cset)

{

$objstream = new Server.CreateObject("adodb.stream");//這個(gè)地方是什么...流?

$objstream->Type = 1;

//...

$text = $objstream->ReadText;//這里是要返回???

$objstream->Close;

$objstream = null;

}

public function steal()

{

if ($this->src_ == "") {

$http = new server.createobject("MSXML2.XMLHTTP");//這里是xml??

$http->open ;//...

//...

if ($http->readystate!=4) {

exit();//這里是中指執(zhí)行

}

$this->value_ = $this->bytesToBstr(Http.responseBody,"GB2312");

$this->isGet_ = true;

$http = null;

if ($err->nulber!=0) { //這個(gè)應(yīng)該不對(duì)

$err->Clear;

}

else {

echo "";

}

}

}

public function change($oldStr,$str)

{

if ($this->isGet_ = false) {

$this->steal();

$this->value_ = str_replace($this->value_,$oldStr,$str);//這里用的是php的函數(shù)

}

}

public function cutX($head,$bot)

{

if ($this->isGet_ = false) {

$this->steal();

if (strstr($this->value_, $head) && strstr($this->value_,$bot)) {//在$this->value中尋找$head ,找到返回true

$this->value_ = false;//這里是什么....

}

else {

$this->value_ = "

單詞不存在

";

}

}

}

}

?>

$myThief=new clsThief;

$myThief->src = "http://www.baidu.com/baidu?ie=gb2312&bs=&sr=&z=&ct=1048576&cl=3&f=8&word=".wd;

$myThief->steal;

$myThief->cutX("

  • ","
  • ");//這里是什么

    $myThief->change("src='IMAGES/","src='http://www.baidu.com/IMAGES/");

    $myThief->change("
    以上結(jié)果由 Dr.eye譯典通字典 提供","");

    $page = $myThief->value;

    $myThief=null;

    $page="".page."";//這個(gè)有什么意義...

    ?>

    <?php echo $wd;?>解釋

    td,body{font-size:14.8px;color:#000}a:link{color:#000066;text-decoration:none}a:visited{COLOR:#000066;

    TEXT-DECORATION:none}a:active{color:red;text-decoration:none}a:hover{color:green;text-decoration:underline}

    .unnamed1 {

    font-size: 9pt; line-height: 20px}

    .font12_bold{

    font-size:12px;

    color:#000000;

    font-weight:bold;

    }

    .ptitle {margin-top:3px; font-weight:bold}

    .pcixin {margin - top : 3px; color = #FF0000}

    .pexplain {margin-top:3px; margin-left:20px}

    .pnewword {margin-top:3px; margin-right:10px; font-size:12; color:#9d0006; font-weight:bold}

    .peng {margin-top:3px; margin-left:40px; font-size:16; color:#0000A0; font-weight:bold}

    .pchi {margin-top:3px; margin-left:40px; font-size:16; color:#800040}

    font.engi {color:#FF00FF; font-style:italic}

    font.chinese {font-weight:normal; font-size:24; color:#008080}

    #ft{clear:both;line-height:20px;background:#E6E6E6;text-align:center}

    #ft,#ft *{color:#77C;font-size:12px;"" align=left>

    #ft span{color:#666}

    .sb{height:2em;width:5.6em;font-size:14px;}

    .kw{font-size:16px;height:1.78em;padding-top:2px;}

    英漢詞典

    <?php echo $wd;?> 的解釋
    <?php echo $page;?>/td>

    -------------------------------------------

    -------------------------------------------

    -----------MyZ的分割線-------------

    -------------------------------------------

    '-------------------------------------------------------------------------------------

    Class clsThief

    '____________________

    Private value_

    '

    Private src_

    '

    Private isGet_

    '

    public property let src(str) '

    src_=str

    end property

    public property get value '

    value=value_

    end property

    Public Property get Version

    Version="Version 2005"

    End Property

    private sub class_initialize()

    value_=""

    src_=""

    isGet_= false

    end sub

    private sub class_terminate()

    end sub

    private Function BytesToBstr(body,Cset) '

    dim objstream

    set objstream = Server.CreateObject("adodb.stream")

    objstream.Type = 1

    objstream.Mode =3

    objstream.Open

    objstream.Write body

    objstream.Position = 0

    objstream.Type = 2

    objstream.Charset = Cset

    BytesToBstr = objstream.ReadText

    objstream.Close

    set objstream = nothing

    End Function

    public sub steal() '

    if src_<>"" then

    dim Http

    set Http=server.createobject("MSXML2.XMLHTTP")

    Http.open "GET",src_ ,false

    Http.send()

    if Http.readystate<>4 then

    exit sub

    end if

    value_=BytesToBSTR(Http.responseBody,"GB2312")

    isGet_= True

    set http=nothing

    if err.number<>0 then err.Clear

    else

    response.Write("")

    end if

    end sub

    public sub change(oldStr,str)

    if isGet_= false then call steal()

    value_=replace(value_ , oldStr,str)

    end sub

    public sub cutX(head,bot)

    if isGet_= false then call steal()

    if instr(value_,head)>0 and instr(value_,bot)>0 then

    value_=mid(value_ ,instr(value_ ,head),instr(value_ ,bot)-instr(value_ ,head)+len(bot))

    else

    value_= "

    單詞不存在"

    end if

    end sub

    end class

    %>

    dim myThief,page

    set myThief=new clsThief

    myThief.src="http://www.baidu.com/baidu?ie=gb2312&bs=&sr=&z=&ct=1048576&cl=3&f=8&word="&wd&""

    myThief.steal

    myThief.cutX "

  • ","
  • "

    myThief.change "src=""IMAGES/","src=""http://www.baidu.com/IMAGES/"

    myThief.change "
    以上結(jié)果由 Dr.eye譯典通字典 提供",""

    page=myThief.value

    set myThief=nothing

    page=""&page&""

    %>

    解釋

    td,body{font-size:14.8px;color:#000}a:link{color:#000066;text-decoration:none}a:visited{COLOR:#000066;

    TEXT-DECORATION:none}a:active{color:red;text-decoration:none}a:hover{color:green;text-decoration:underline}

    .unnamed1 {

    font-size: 9pt; line-height: 20px}

    .font12_bold{

    font-size:12px;

    color:#000000;

    font-weight:bold;

    }

    .ptitle {margin-top:3px; font-weight:bold}

    .pcixin {margin - top : 3px; color = #FF0000}

    .pexplain {margin-top:3px; margin-left:20px}

    .pnewword {margin-top:3px; margin-right:10px; font-size:12; color:#9d0006; font-weight:bold}

    .peng {margin-top:3px; margin-left:40px; font-size:16; color:#0000A0; font-weight:bold}

    .pchi {margin-top:3px; margin-left:40px; font-size:16; color:#800040}

    font.engi {color:#FF00FF; font-style:italic}

    font.chinese {font-weight:normal; font-size:24; color:#008080}

    #ft{clear:both;line-height:20px;background:#E6E6E6;text-align:center}

    #ft,#ft *{color:#77C;font-size:12px;"" align=left>

    #ft span{color:#666}

    .sb{height:2em;width:5.6em;font-size:14px;}

    .kw{font-size:16px;height:1.78em;padding-top:2px;}

    英漢詞典

    的解釋

    很對(duì)不住了.能改的我都改了...其他的忘了很多...有些不熟.....

    by mayongzhan

    總結(jié)

    以上是生活随笔為你收集整理的bytestobstr php,一段asp转php的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。