Adjusting Behavior for Server Settings
In the last chapter, the escape_data() function was defined as a way to sanctify user input before storing it in a database. At that time I briefly discussed the ini_get() function, which returns the php.ini setting for a submitted configuration option. In that example, I checked if Magic Quotes (magic_quotes_gpc, specifically) was on, as I don’t want to over-escape submitted data. Using the ini_get() function is just one way you can improve the portability of your PHP applications by making scripts behave differently according to server-specific information.
Complementing the ini_get() function is ini_set(), which changes a PHP configuration for the duration of that script. This tool was mentioned in ...
Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.