Skip to Content
PHP编程:第4版
book

PHP编程:第4版

by Kevin Tatroe, Peter MacIntyre
January 2021
Intermediate to advanced
505 pages
9h 45m
Chinese
Publishing House of Electronics Industry
Content preview from PHP编程:第4版
php.ini
的配置
357
可以考虑在生产环境中使用
404
页面重定向和
try…catch
结构来重定向错误
和将失败引导到一个安全的区域。可参照第
2
章的介绍以正确使用
try…catch
语法。
最起码地,在生产环境中,所有的错误报告应该被抑制并被发送到日志文件。
php.ini
的配置
应该为你开发代码的每台服务器配置相同的环境。首先,我们要简短地描述环境是什么;
然后,将列出每种环境推荐的设置。
display_errors
一个控制是否显示
PHP
遇到错误的开关。这个设置在生产环境中需要被设置为
0
off
)。
error_reporting
这是一个对预定义常量的配置,这些常量决定了将
PHP
遇到的错误报告到错误日志
和(或)网页浏览器。可以在这个指令中使用
16
个不同的常量。最常见的是
E_ALL
报告所有错误和警告
E_WARNING
,只将警告(非致命错误)展示到浏览器
E_
DEPRECATED
,展示运行时提示,如在将来的
PHP
版本中会过期的功能警告(例如,
register_globals
)。如果有
E_ALL & ~E_NOTICE
合并使用的例子,那将告诉
PHP
报告除提示外的所有错误。在链接
34
所示的网址可以找到完整的常量列表。
error_log
设置错误日志的位置。错误日志是一个基于文本的文件,在服务器上以文本记录所
有错误的位置。在
Apache
服务器上可能在于
apache2/logs
variables_order
设置超全局数组加载信息数据的优先次序。默认的次序是
EGPCS
,这意味着环境 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

解密金融数据

解密金融数据

Justin Pauley
算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow
Java持续交付

Java持续交付

Daniel Bryant, Abraham Marín-Pérez

Publisher Resources

ISBN: 9787121404634