如何使标题位置301在PHP通过编码


How to Make Header Location 301 in PHP via Coding

我有这些代码工作良好的echo $data[''.$itag.'']['url']获取链接url,但当我使用这个代码重定向301头位置这个代码不工作,请任何人告诉我可以用这个代码做什么获取301头位置

<?php header("Location: "echo $data[''.$itag.'']['url']"", true, 301); exit();?>

请建议此代码

<?php 
    header("Location: ".$data[$itag]['url'], true, 301); 
    exit();
?>