php - url 扰乱了 php 中的布局

标签 php html layout

我只在 .htacess 文件中发现了问题,但没有找到解决方案

RewriteRule ^test/(.*)?$ findjob4.php?skills=$1
RewriteRule ^test-(.*)?$ findjob4.php?skills=$1

URL 1 : www.example.com/test-software
URL 2 : www.example.com/test/software

当使用 URL 2 时,页面的布局会受到干扰,而当我使用 URL 1 时,它运行良好(没有一个错误)。 任何人都可以让我知道,为什么和什么是问题

刚刚在上面添加了新的查询


我在使用 .htacess 和正常 url 写入时遇到错误

.htacess

RewriteRule ^search-jobs/(.*)?$ findjob4.php?skills=$1

findjob4.php

<?php
    if (isset($_GET['skills']) or !empty($_GET['skills'])) {
        $d_skills = $_GET['skills'];
        $d_skills = str_replace('-', ' ', $d_skills);
    } else {
        $d_skills = ""; 
    }   
    $d_location = "texas";
    $page = 1;
?>

<?php require('header.php'); ?>

<div id="container">
    <?php  do_job_search6($d_skills, $d_location, $page); ?>
</div>
<?php require('footer.php'); ?>

现在,当我用 findjob4.php?skills=software 打开 url 时,它完美地显示了布局。

search-jobs/software 中,结果不错,但布局主要在页脚区域受到干扰。

当我在 Chrome 中使用 Developer ToolsInspect Element 并在 console 选项卡下使用时 我明白了

Resource interpreted as Image but transferred with MIME type text/html: "http://localhost/example/search-jobs/software/images/loadingAnimation.gif"

这个错误是连续的..页脚的内容随着主容器的空内容而改变..

Javascript : jquery 库错误

(anonymous function)
jQuery.Callbacks.fire
jQuery.Callbacks.self.fireWith
jQuery.extend.ready

我有一张图片供下面引用。

图片1

enter image description here

图片2

enter image description here

下面是 ROOT_URL 常量,我用它作为路径。

<?php
    define('ROOT_DIR', dirname(__FILE__));
    define('ROOT_URL', substr($_SERVER['PHP_SELF'], 0, - (strlen($_SERVER['SCRIPT_FILENAME']) - strlen(ROOT_DIR))));
?>

最佳答案

使用图像的绝对路径而不是相对路径。

<img src="http://localhost/example/images/loadingAnimation.gif" />

相对于

<img src="images/loadingAnimation.gif" />

关于php - url 扰乱了 php 中的布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11280408/

相关文章:

php - MySQL按年月日计算年龄

php - 使用 php 和 mysql 按月报告?

Html 按钮提交未完全显示

Android DialogPreference 布局 TextSize

android - ImageView 在图像的顶部和底部显示空白

php - 在 PHP 中生成 4 到 8 个字符的随机字符串

php - php:如何与后台运行的PHP脚本进行通信?

html - 边框图像渐变在 IE10 中不起作用?

html - 向表达式内部 Ruby 字符串中的单词添加文本样式

Android:如何使 View 的背景不可见?