我从 foreach 循环创建了一个链接,因为我在 jquery 函数中显示了一个具有不同参数的链接
<?php
foreach ($questions as $row) {
if (!empty($row['url_ImageName'])) {
$url_ImageName = $row['url_ImageName'];
}else{
$Paragraph = $row['Paragraph'];
}
?>
<a href="#" id="opendetail" onclick="question_details('<?php echo $url_ImageName; ?>','<?php echo $Paragraph; ?>')">Show Details</a>
<?php
} ?>
function question_details(url_ImageName,Paragraph){
if (url_ImageName != '')
{
$(".exam-slideout .question-details img").attr("src",url_ImageName);
}
if (Paragraph != '')
{
$('.exam-slideout .question-details div').html(Paragraph);
}
}
在创建这个的第一个链接中:
<a href="#" id="opendetail" onclick="onclick="question_details('','“ What the deuce is it to me ” ? he interrupted impatiently: “ you say that we go round the sun. If we went round the moon it would not make a pennyworth of difference to me or to my work.”')">Show Details</a>
以及创建此的第二个链接:
<a href="#" id="opendetail" onclick="question_details('','Complete drying is essential before adding the sealant so that the paint doesn't smear.')">Show Details</a>
在那,我遇到了单引号和双引号的问题。
为了解决这个问题,我试一试
$Paragraph = mysqli_real_escape_string($con, $row['Paragraph']);
但功能仍然无法处理语法错误。
任何人都可以帮助我。
ABOUTYOU