我试图回忆一下foreach中的内容.此时,当用户填写表单时,将显示每个跳过的记录的消息.如果跳过35条记录,由于foreach,我将收到35条消息.我想避免这种情况,并且只能为整个结果页面显示一个回声.我怎样才能做到这一点?我想我可能不得不在foreach之外做这件事,但我不知道如何把它从foreach中取出来.
foreach($allcourses as $course)
{
if(Auth::LoggedIn())
{
if(Auth::$userinfo->rank == 'Student')
{
if($course->aircraft == '1')
{
echo '<div class="msg-red">Some lessons could not be found, because you may not be entitled to view/book them at this stage of your course.</div><br/>';
continue;
}
if($course->aircraft == '2')
{
echo '<div class="msg-red">Some lessons could not be found, because you may not be entitled to view/book them at this stage of your course.</div><br/>';
continue;
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我希望能够在JavaScript字符串中回显PHP链接,即<?php echo SITE_URL ?>.如何使用下面的代码执行此操作?
<script type="text/javascript">
$.backstretch("http://www.example.com/bg.jpg");
</script>
Run Code Online (Sandbox Code Playgroud)