thinkphp引入字体文件时候被当做模块求解决问题
这是字体路径http://localhost/zx/Public/css/fonts/字体.ttf
CSS引入字体的时候被当做模块了
出现这样的情况
无法加载模块:Public
错误位置
FILE: D:\www\zx\ThinkPHP\Common\functions.php LINE: 112
请问下这样话怎么处理
回复讨论(解决方案)
不把public跟模板放在同一目录下不就行了?
css js ttf 这些的软件肯定要放在根目录下的文件夹 怎么可能放和模板一样的目录下
无法加载模块:Public。这个错误,是你在浏览器访问字体文件的时候,通过http://localhost/zx/Public/css/fonts/字体.ttf这个链接来访问,Public被当成模块,css被当成控制器,fonts被当成方法,字体被当做URL参数导致的。另外:在css文件里引入字体和图片,应该用相对路径来引入。
子目录 zx/Public/css 不存在
所以这个路径被当作指令处理了
目录是在的 css目录下的css文件引入成功了
无法加载模块:Public。这个错误,是你在浏览器访问字体文件的时候,通过http://localhost/zx/Public/css/fonts/字体.ttf这个链接来访问,Public被当成模块,css被当成控制器,fonts被当成方法,字体被当做URL参数导致的。另外:在css文件里引入字体和图片,应该用相对路径来引入。
用的是相对路径
子目录 zx/Public/css 不存在
所以这个路径被当作指令处理了
目录是在的 css目录下的css文件引入成功了
rewriter的问题
rewriter的问题
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
文件地址不对 文件找不到的情况下 因为开了rewrite 被当成模块了
文件地址不对 文件找不到的情况下 因为开了rewrite 被当成模块了
文件地址没问题呀
你重新规制目录吧,将Public放到根目录,再将字体文件放到Public里, 这样 /Public/fonts/字体.ttf
文件地址不对 文件找不到的情况下 因为开了rewrite 被当成模块了
文件地址没问题呀
把apache的rewrite关了 然后访问http://localhost/zx/Public/css/fonts/字体.ttf 看看是404吗
你重新规制目录吧,将Public放到根目录,再将字体文件放到Public里, 这样 /Public/fonts/字体.ttf
zx是一个项目文件 public就在这个项目文件的根目录下
文件地址不对 文件找不到的情况下 因为开了rewrite 被当成模块了
文件地址没问题呀
把apache的rewrite关了 然后访问http://localhost/zx/Public/css/fonts/字体.ttf 看看是404吗
没成功,你有没有碰过这样的情况
你把目录结构贴出来
问题解决了。经过排查是CSS文件引入错了,css引入的字体是上一层目录,字体在当前目录。CSS用的是框架 所以没去看里面的代码。之前想到是路径的问题 但是试了下没成功 今天又重看了下代码。感谢大家的回答

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot
