我的网址重写有问题。该链接有效,但输出的是简单的非样式HTML。之前没见过,或者我忽略了一些非常简单的事情,所以任何帮助都会得到很好的接受。
这是我的.htacess重写
function url_slug($string, $space = '-') {
$string = str_replace('&', 'and', $string);
$string = preg_replace('/[^a-zA-Z0-9 _-]/', '', $string);
$string = strtolower($string);
$string = preg_replace('/[ ]+/', ' ', $string);
$string = str_replace(' ', $space, $string);
return $string;
}
这是我的php函数
<?php
$sql = DB::getInstance()->query('SELECT * FROM gallery ORDER BY id ASC LIMIT 0, 6');
foreach($sql->results() as $row) {
?>
<div class="col-md-4 col-sm-6 port-item">
<div class="port-mask">
<?php
$id = escape($row->id);
$title = escape($row->url);
$string = url_slug($title);
echo '<a href="gallery/' . $id . '/' . $string . '"><h3>' . escape($row->section_title) . '</h3></a>';
?>
<div class="port-line clearfix"></div>
<p><?php echo escape($row->section_category) ?></p>
<?php
echo '<a href="gallery/' . $id . '/' . $string . '"><i class="viewbtn fa fa-long-arrow-right"></i></a>';
?>
<a href="images/gallery/<?php echo escape($row->section_image) ?>" data-rel="prettyPhoto"><i class="viewimg fa fa-search"></i></a>
</div>
<img src="images/gallery/<?php echo escape($row->section_image) ?>" alt="<?php echo escape($row->alt) ?>">
</div>
<?php
}
?>
这是我的索引页面,其中包含画廊部分
<?php
$sql = DB::getInstance()->get('gallery', array('id', '=', Input::get('id')));
foreach($sql->results() as $row) {
?>
<section class="top-content clearfix">
<div class="clearfix big-box para-opacity" data-auto-play="9000" data-stellar-ratio="0.4" data-stellar-position-property="position">
<div class="box-title">
<p><?php echo escape($row->gallery_slider_p) ?></p>
<div class="clearfix"></div>
<h3><?php echo escape($row->gallery_slider_h3) ?></h3>
</div>
<div class="works-slider slider" data-auto-play="9000">
<div class="slide img-bg clearfix" data-background="images/gallery/<?php echo escape($row->gallery_slider) ?>"></div>
</div>
</div>
</section>
<?php
}
?>
这是我上面链接中的gallery.php
http://localhost/projects/XXXPROJECTXXX/index
点击时的URL链接从index.php
开始http://localhost/projects/XXXPROJECTXXX/gallery/1/chinese-contemporary-abstract-lady
到gallery.php
email
那么,有什么不对?在此先感谢: - )
答案 0 :(得分:0)
.htaccess用url创建问题,
你可以改变你的所有网址
图片
JS
css
进入绝对网址,在其中添加您的域名,这对我有用。