dsjk3214 2016-03-20 04:15
浏览 36
已采纳

PHP中的警报如果不在内部工作

I want to put an alert inside an if (in a php document) with other actions. The other actions works fine but not the alert. Can anybody help me?. This is where the alert is:

if(empty($response)){ 
    //SOME ACTIONS
    echo '<script type='text/javascript'> alert("Message´s 1st line
Message´s 2nd line");</script>';
    //SOME ACTIONS
    header('Location: SOMEWEBSITE');                                
}else{ 
   //ANOTHER ACTION
} 

All actions works fine except for the alert. I tried on different browsers but the alert doesnt appear.

Sorry for my english

Thank you all.

  • 写回答

5条回答 默认 最新

  • donglou8371 2016-03-20 04:52
    关注

    Try This echo '<script type="text/javascript">alert("Message´s 1st line Message´s 2nd line");</script>'

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?