gpt4 book ai didi

php - 如何按类别 ID 包含两个文件

转载 作者:行者123 更新时间:2023-11-29 05:27:16 25 4
gpt4 key购买 nike

我有一个文件,我想将另外两个文件放在这个文件中,它们将是动态的。主文件是这样的:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Gaming Ventus Let's Play - VLet's Play</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../styles/article_style_readmore.css">
<link rel="stylesheet" type="text/css" href="../../styles/styles_content_static_contact/styles_alltemplate_static_contact.css">
<link rel="stylesheet" type="text/css" href="../styles/readmore_mainbody_style.css">

<link rel="stylesheet" type="text/css" href="../../test/test2/Untitled-3.css">

</head>
<body>

<div id="wrapper">
<div id="header">
<div id="top_header">
<ul id="icons">
<li><a href="http://youtube.com/" target="_blank"><img src="../../images/youtube-icon.png" alt="YT" width="32" height="32" /></a></li>
<li><a href="http://facebook.com/" target="_blank"><img src="../../images/facebook-icon.png" alt="Fb" width="32" height="32" /></a></li>
<li><a href="http://twitter.com/" target="_blank"><img src="../../images/twitter-icon.png" alt="Twit" width="32" height="32" /></a></li>
<li><a href="http://google.com/" target="_blank"><img src="../../images/google-icon.png" alt="Goog" width="32" height="32" /></a></li>
<li><a href="#" target="_blank"><img src="../../images/rss-icon.png" alt="Rss" width="32" height="32" /></a></li>
</ul>
</div>

<div id="bottom_header">
<a href="../../index.php?page=home">
<div id="logo"><img src="../../images/Ventus_Gaming_logo.png"></div>
</a>
<div id="search_bar">
<form>
<input type="text" id="search">
<label for="search">Search</label>
</form>
</div>
</div>
</div>

<div id="menu">
<ul>
<li><a href="../../index.php?page=home">Home</a></li>
<li><a href="../../index.php?page=reviews">Reviews</a></li>
<li><a href="../../index.php?page=news">News</a></li>
<li><a href="../../index.php?page=videos">Videos</a></li>
<li><a href="../../index.php?page=photos">Photos</a></li>
<li><a href="../../content_static_main_body/contact.php?page=contact">Contact Us</a></li>
</ul>
</div>

<div id="main_body">
<div id="main_left_nav">
/****************************************************************\
<?php

include('function_art_result_readmore.php');
include('function_art_result_readmore_photos.php');

?>
\****************************************************************/

</div>

<div id="right_nav">
<div id="right_nav_about">
About!
</div>
<div class="right_nav_others">
Reviews!
</div>
<div class="right_nav_others">
News!
</div>
<div class="right_nav_others">
Videos!
</div>
<div class="right_nav_others">
Photos!
</div>
</div>
</div>

<div id="footer">
<p>Copyright Ventus Gaming</p>
</div>
</div>

<?php
//Ayto einai to apotelesma otan patas to read more dhladh ta post mona tous
?>
</body>
</html>

所以在星号部分我有这两个文件,我想包括...这些文件有 mysql 代码和 php 代码。所以我想像这样包括它们:

<?php 
if ($CatID == 8) {
include('function_art_result_readmore.php');
} else {
include('function_art_result_readmore_photos.php');
}
?>

但这不起作用,仅作为示例。所以我想按类别 ID 打开包含文件,这样我就可以随时拥有这两个文件。当然,如果有另一种解决方案,我接受 :)

提前致谢!

最佳答案

在请求中传递类别 ID(使用以下代码通过 GET 或 POST):

if(isset($_REQUEST['category_id']) &&  $_REQUEST['category_id'] == '8') {          
include('function_art_result_readmore.php');
} else {
include('function_art_result_readmore_photos.php');
}

`

关于php - 如何按类别 ID 包含两个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18765394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com