Home php教程 php手册 JoshChen_web格式编码UTF8-无BOM的小细节分析

JoshChen_web格式编码UTF8-无BOM的小细节分析

Jun 06, 2016 pm 08:27 PM
analyze Format detail coding

下面这张图是用chrome浏览器打开一个2012年-2013学年第二学期的PHP课程的期末作业,用的是PHP + smarty + mysql来实现的

但是在开发的过程中,发现一个小细节的问题,香港服务器租用,必须要打开F12才能看到的,原来,在head头部里面的所有引用的东西以及title等等,全部都跑到body里面去了,苦思冥想,百度、google全找不到答案。只好放弃了因为他并没有影响到我的功能以及页面上的样式。

而到了今天,在开发别的项目的时候,页面用到了frameset,虚拟主机,我想大家应该都明白,frameset只有放在body外面才能使用。然而也是因为这个问题,把head里面的,以及frmaeset的内容全部跑到body里面,而且在body下还有一个空白行,结果整个页面全部显示空白,没有了想要的效果。

后来不爽的打开ThinkPHP手册,继续学习这个框架,但没有想到呀。在ThinkPHP手册里面竟然有一句话提醒了我,让我产生兴趣,立刻就想到了这个问题有可能是导致的那个原因。
贴图如下:

于是,去百度了一下BOM信息头, 下面是资料搜索出来的信息:

“PHP并不会忽略BOM,所以在读取、包含或者引用这些文件时,会把BOM作为该文件开头正文的一部分。根据嵌入式语言的特点,这串字符将被直接执行(显示)出来。由此造成即使页面的 top padding 设置为0,也无法让整个网页紧贴浏览器顶部,因为在html一开头有这3个字符呢!”

所以啊,就是因为这个问题,导致头部一直靠不上去。终于找到了解决的方法了。于是,下载了个Notepad++文本编辑器来修改我的所有PHP的文件,改完后,果断成功了。顿时开心的啊……

修改完成,保存,页面刷新。

大家再看看,头部的信息有了!!完成了!我的frameset也终于没有问题了!之前的项目也搞定了!好开心!哈哈!!

小小的程序猿就是这样,遇到点点小问题就烦烦燥燥,没耐心去解决。但是,解决了后,才发现那种兴奋,香港虚拟主机,那种满足…哈,程序猿你懂哈,我们其实都很简单!

语言只能是口语化了,不专业,不要见怪,只希望大家能懂哈。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use block quotes in Apple Notes How to use block quotes in Apple Notes Oct 12, 2023 pm 11:49 PM

In iOS 17 and macOS Sonoma, Apple has added new formatting options for Apple Notes, including block quotes and a new Monostyle style. Here's how to use them. With additional formatting options in Apple Notes, you can now add block quotes to your notes. The block quote format makes it easy to visually offset sections of writing using the quote bar to the left of the text. Just tap/click the "Aa" format button and select the block quote option before typing or when you are on the line you want to convert to a block quote. This option applies to all text types, style options, and lists, including checklists. In the same Format menu you can find the new Single Style option. This is a revision of the previous "equal-width"

How to write the qq mailbox format? What is the qq mailbox format? How to write the qq mailbox format? What is the qq mailbox format? Feb 22, 2024 pm 03:40 PM

QQ email: QQ number@qq.com, English QQ email: English or numbers@qq.com, foxmail email account: set up your own account@foxmail.com, mobile phone email account: mobile phone number@qq.com. Tutorial Applicable Model: iPhone13 System: IOS15.3 Version: QQ Mailbox 6.3.3 Analysis 1QQ mailbox has four formats, commonly used QQ mailbox: QQ number@qq.com, English QQ mailbox: English or numbers@qq.com, foxmail Email account: set up your own account@foxmail.com, mobile phone email account: mobile phone number@qq.com. Supplement: What is qq mailbox? 1 The earliest QQ mailbox was only between QQ users

How to implement data statistics and analysis in uniapp How to implement data statistics and analysis in uniapp Oct 24, 2023 pm 12:37 PM

How to implement data statistics and analysis in uniapp 1. Background introduction Data statistics and analysis are a very important part of the mobile application development process. Through statistics and analysis of user behavior, developers can have an in-depth understanding of user preferences and usage habits. Thereby optimizing product design and user experience. This article will introduce how to implement data statistics and analysis functions in uniapp, and provide some specific code examples. 2. Choose appropriate data statistics and analysis tools. The first step to implement data statistics and analysis in uniapp is to choose the appropriate data statistics and analysis tools.

Knowledge graph: the ideal partner for large models Knowledge graph: the ideal partner for large models Jan 29, 2024 am 09:21 AM

Large language models (LLMs) have the ability to generate smooth and coherent text, bringing new prospects to areas such as artificial intelligence conversation and creative writing. However, LLM also has some key limitations. First, their knowledge is limited to patterns recognized from training data, lacking a true understanding of the world. Second, reasoning skills are limited and cannot make logical inferences or fuse facts from multiple data sources. When faced with more complex and open-ended questions, LLM's answers may become absurd or contradictory, known as "illusions." Therefore, although LLM is very useful in some aspects, it still has certain limitations when dealing with complex problems and real-world situations. In order to bridge these gaps, retrieval-augmented generation (RAG) systems have emerged in recent years. The core idea is

Several common encoding methods Several common encoding methods Oct 24, 2023 am 10:09 AM

Common encoding methods include ASCII encoding, Unicode encoding, UTF-8 encoding, UTF-16 encoding, GBK encoding, etc. Detailed introduction: 1. ASCII encoding is the earliest character encoding standard, using 7-bit binary numbers to represent 128 characters, including English letters, numbers, punctuation marks, control characters, etc.; 2. Unicode encoding is a method used to represent all characters in the world The standard encoding method of characters, which assigns a unique digital code point to each character; 3. UTF-8 encoding, etc.

Tutorial on modifying the text format of Win10 computer Notepad Tutorial on modifying the text format of Win10 computer Notepad Dec 25, 2023 pm 06:31 PM

When using the Notepad tool to save some text, sometimes you need to drag it into software such as Word for use. However, many users don’t know how to change the format of Notepad, so let’s take a look at the detailed tutorial. ~How to change the format of Notepad in Win10: 1. After opening Notepad, click "File-Save As" at the top. 2. Then add the format you want to the file name, for example, the editor added ".rtf". Select "All Files" as the save type and save. 3. Then our file format will become an rtf format file. 4. We double-click to open the modified file, and all the contents are there.

Analysis of the reasons why the secondary directory of DreamWeaver CMS cannot be opened Analysis of the reasons why the secondary directory of DreamWeaver CMS cannot be opened Mar 13, 2024 pm 06:24 PM

Title: Analysis of the reasons and solutions for why the secondary directory of DreamWeaver CMS cannot be opened. Dreamweaver CMS (DedeCMS) is a powerful open source content management system that is widely used in the construction of various websites. However, sometimes during the process of building a website, you may encounter a situation where the secondary directory cannot be opened, which brings trouble to the normal operation of the website. In this article, we will analyze the possible reasons why the secondary directory cannot be opened and provide specific code examples to solve this problem. 1. Possible cause analysis: Pseudo-static rule configuration problem: during use

uefiu disk song format uefiu disk song format Feb 12, 2024 pm 10:18 PM

With the continuous updating of win10 system, its original installation image is getting larger and larger, which brings troubles to students who like to use U disk for UEFI boot method installation. As we all know, using EFI method to install the system directly installs the original Microsoft image. After decompressing, copy to the root directory of the U disk in fat32 or fat16 format, and then directly set the motherboard U disk to start the installation. However, many friends have reported that it backfired recently. There is a restriction on using the U disk in fat format, that is, a single file. The maximum cannot exceed 4G, otherwise it will be impossible to write. However, as the win10 image increases, the install.wim file in the installation package becomes larger and larger, exceeding 4G, which makes it impossible to directly use

See all articles