第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

變量已經(jīng)在方法中定義但執(zhí)行的時(shí)候還報(bào)錯(cuò)?

Notice: Undefined variable: link_start in D:\wamp\www\mysqli\comment.class.php on line?70這個(gè)變量已經(jīng)定義在這個(gè)方法里面了,但是那個(gè)首頁還是報(bào)錯(cuò)?

這下面是comment.class.php中的代碼
public function output(){
?? ??? ?if($this->data['url']){
?? ??? ??? ?$link_start="<a href='".$this->data['url']."' target='_blank'>";

?? ??? ??? ?$link_end="</a>";
?? ??? ?}
?? ??? ?$dateStr=date("Y年m月d日 H:i:s",$this->data['pubTime']);
?? ??? ?$res=<<<EOF
?? ??? ?<div class='comment'>
?? ??? ??? ?<div class='face'>
?? ??? ??? ??? ?{$link_start}
?? ??? ??? ??? ??? ?<img width='50' height='50' src="img/{$this->data['face']}.jpg" alt="" />
?? ??? ??? ??? ?{$link_end}
?? ??? ??? ?</div>
?? ??? ??? ?<div class='username'>
?? ??? ??? ??? ?{$link_start}
?? ??? ??? ??? ?{$this->data['username']}
?? ??? ??? ??? ?{$link_end}
?? ??? ??? ?</div>
?? ??? ??? ?<div class='date' title='發(fā)布于{$dateStr}'>
?? ??? ??? ??? ?{$dateStr}
?? ??? ??? ?</div>
?? ??? ??? ?<p>{$this->data['content']}</p>
?? ??? ?</div>
EOF;
?? ??? ??? ?return $res;
?? ?}

70行的代碼是<div class='face'>下的{link_start}這里,其他地方的link_start, link_end 也報(bào)錯(cuò),請(qǐng)問這是什么 原因?

正在回答

3 回答

直接修改PHP配置文件中error_reporting=E_ALL&~E_NOTICE,重啟服務(wù)器即可

^-^...

1 回復(fù) 有任何疑惑可以回復(fù)我~

回復(fù) 早安EchoMichael:我今天剛遇到這個(gè)問題,困擾了我兩天,至于這個(gè)問題出現(xiàn)的原因,我猜測(cè)是php版本不同解析代碼不同的問題,

我的解決辦法如下:

if($this->data['url']){

? ? ? ? ? ? $url=$this->data['url'];

? ? ? ? ? ? $dateStr=date("Y年m月d日 H:i:s",$this->data['pubTime']);

? ? ? ? ? ? $res=<<<EOF

? ? ? ? <div class='comment'>

? ? ? ? ? ? <div class='face'>

? ? ? ? ? ? ? ? <a href="{$url}" target='_blank'>

? ? ? ? ? ? ? ? ? ? <img width='50' height='50' src="img/{$this->data['face']}.jpg">

? ? ? ? ? ? ? ? </a>

? ? ? ? ? ? </div>

? ? ? ? ? ? <div class='username'>

? ? ? ? ? ? ? ? <a href="{$url}" target='_blank'>

? ? ? ? ? ? ? ? ? ? {$this->data['username']}

? ? ? ? ? ? ? ? </a>

? ? ? ? ? ? </div>

? ? ? ? ? ? <div class='date' title='發(fā)布于{$dateStr}'>

? ? ? ? ? ? ? ? {$dateStr}

? ? ? ? ? ? </div>

? ? ? ? ? ? <p>{$this->data['content']}</p>

? ? ? ? </div>

EOF;

? ? ? ? ? ? return $res;

? ? ? ? }else{

? ? ? ? ? ? $dateStr=date("Y年m月d日 H:i:s",$this->data['pubTime']);

? ? ? ? ? ? $res=<<<EOF

? ? ? ? <div class='comment'>

? ? ? ? ? ? <div class='face'>

? ? ? ? ? ? ? ? ? ? <img width='50' height='50' src="img/{$this->data['face']}.jpg">

? ? ? ? ? ? </div>

? ? ? ? ? ? <div class='username'>

? ? ? ? ? ? ? ? ? ? {$this->data['username']}

? ? ? ? ? ? </div>

? ? ? ? ? ? <div class='date' title='發(fā)布于{$dateStr}'>

? ? ? ? ? ? ? ? {$dateStr}

? ? ? ? ? ? </div>

? ? ? ? ? ? <p>{$this->data['content']}</p>

? ? ? ? </div>

EOF;

? ? ? ? ? ? return $res;

? ? ? ? }

對(duì)當(dāng)前url地址做一個(gè)判斷,如果存在則傳入地址,否則不使用超連接,測(cè)試了一下,效果是一樣的

希望這對(duì)你有幫助 互相幫助 共同進(jìn)步


2 回復(fù) 有任何疑惑可以回復(fù)我~

根本不是erro_reporting的問題,是因?yàn)?this->data['url']為空時(shí)沒有任何處理

1 回復(fù) 有任何疑惑可以回復(fù)我~
#1

早安EchoMichael

那怎么辦那
2016-07-17 回復(fù) 有任何疑惑可以回復(fù)我~
#2

白素貞的許仙

看下面回復(fù),這有字?jǐn)?shù)限制
2016-11-01 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

變量已經(jīng)在方法中定義但執(zhí)行的時(shí)候還報(bào)錯(cuò)?

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)