使用以下代码之后触发函数之后打开是空白页面about:blank右键打开新标签页就可以获取地址,但是直接触发就不行
打开新标签页的话地址不变,不过图片右下角location和我定义的不一样
点击编辑和重发的话域名会变成location地址也试过在php中嵌套JavaScript语句,但是全部显示出源码而不是执行
希望懂得的大佬帮助一下,非常感谢!
<?php
$q=$_GET["q"];
$con = mysqli_connect('localhost', 'root', '060896');
$jsonArray1 = array();
if (!$con){
 die('Could not connect: ' . mysqli_error());
}
mysqli_select_db($con, "sina");
mysqli_set_charset($con, "utf8");
$sql="SELECT * FROM content, sinanews where news_href = news_html and news_html in (select news_html from dailynews);";
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_assoc($result))
 {
array_push($jsonArray1,$row['news_href']);
};
if ($q==1){
$str1 = $jsonArray1[0];}
else if ($q==2){
    $str1 = $jsonArray1[1];}
else if ($q==3){
$str1 = $jsonArray1[2];}
else if ($q==4){
$str1 = $jsonArray1[3];}
else if ($q==5){
$str1 = $jsonArray1[4];}
//header("Content-Type:test/html;charset=utf-8");
header("Location:$str1"); 
exit;