Fájlformátumok
A PEAR raktár összes szkriptje a következő elvárásoknak kell, hogy megfeleljen:
-
ASCII szöveg formátumban legyen tárolva
-
ISO-8859-1 karakter kódolással legyen megírva
-
Unix formátumú legyen
A "Unix formátumú" a következő két dolgot jelenti:
1) A sorok végén csak egy soremelés lehet (line feed, LF).
A soremelések karakterkódja
decimális 10,
oktális 012 és
hexadecimális 0A.
Ne használjuk a Macintosh számítógépekre jellemző
kocsivissza-jeleket (carriage return, CR),
illetve a Windows rendszerekre jellemző kocsivissza/soremelés
kombinációt (CRLF).
2) Legyen egy soremelés a záró PHP tag után
(?>). Ez azt jelenti, hogy ha a kurzor a
fájl legvégén áll, egy sorral van a záró PHP
tag alatt.
Elnevezési szabályok (Previous)
|
(Next) Sample File (including Docblock Comment standards)
|
|
|
Download Documentation
|
Last updated: Sun, 18 Oct 2009 |
|
Do you think that something on this page is wrong? Please file a bug report or add a note.
|
| User Notes: |
I don't like these rules.
You require @author tag, and my name cannot be properly written in ASCII or ISO-8859-1. I think requirement of UTF-8 is much more reasonable these days.
Although "?>\n" is harmless, any accidentally added lines after that will be output and will cause trouble. I don't see any benefit in having "?>" and I see potential pitfalls, so IMHO it should be forbidden, rather than required.
shiplu.net..., you're wrong. The described line feeds are intended to not cause trouble e.g. with the header() or with session functions. Problems would arise only if there would be any more whitespace after the closing tag.
Note by: shiplu.net@gmail.com
LF after ?> is not a good idea.
It'll cause problem while working with headers.
I think this rule should be omitted.
cbrunet: Adding a single line-feed after the closing ?> does not cause headers to be sent. It is ignored by PHP.
Adding a LF after the last ?> could cause a problem to scripts that need to be executed before headers are sent. I will send a newline to the browser, causing headers to be send.
Note by: Dev
Whay not use the unicode utf-8 format?
|
|