我有報價問題。我不能使用「或」適用於$的gname,我可以爲此做些什麼。2個不同的報價內的PHP報價
$new_post = array('post_content' => ' ..CODES.. $result = mysqli_query($con,"SELECT * FROM wp_games WHERE name = $gname "); ..CODES..
我試圖創建一個職位上wordpress.I有一個插件來使用PHP的信息。[ insert_php]是這個插件。而且我也不能使用引號如\「... \」。這裏是更多的代碼。
$new_post = array(
'post_content' => '[insert_php]$con=mysqli_connect("localhost","root","","wordpress");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM wp_games WHERE name = '$gname' ");
while($row = mysqli_fetch_assoc($result)) {
echo $row["name"];
}
mysqli_close($con);
[/insert_php]',
這在很多層面都被破壞 - 非常混亂,並且容易出現氾濫的PHP和/或SQL注入。無論如何,請參閱[PHP字符串](http://php.net/manual/en/language.types.string.php)瞭解引號如何在PHP字符串上下文中轉義。 (其中,就像Inception的一個糟糕的重製,內部字符串文字是兩個深度..) – user2864740 2014-10-04 22:25:13
發佈你的實際代碼,我不幫助回答僞裝,它只是讓我們猜測,直到奶牛回家。 – 2014-10-04 22:25:17
http://stackoverflow.com/help/how-to-ask – 2014-10-04 22:27:16