1. Trang chủ
  2. » Công Nghệ Thông Tin

PHP Developer''''s Dictionary- P30 pps

5 164 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 363,53 KB

Nội dung

PHP Developer’s Dictionary IT-SC book 145 routine of a C program. A warning will be generated if called from outside a user- defined function definition. func_num_args() Syntax int func_num_args(void ) Description The func_num_args() function , which was added in PHP 4.0b4, returns a count of the arguments passed into the current user-defined function. A warning will be generated if called from outside a user-defined function definition. function_exists Syntax int function_exists(string function_name) Description The function_exists() function, which was added in PHP 3.0.7 and PHP 4.0b4, returns true if a function named function_name has been defined; otherwise, it returns false. get_browser() Syntax object get_browser(string [user_agent] ) Description The get_browser() function is used to determine the capabilities of the client's browser that is making the request. The browser capabilities are defined in the browscap.ini file. If the user_agent is not set, the $HTTP_USER_AGENT environment variable will be used as the key into the browscap.ini file. An object is returned that provides details on the capabilities of the browser, including JavaScript and cookie support. PHP Developer’s Dictionary IT-SC book 146 ignore_user_abort() Syntax int ignore_user_abort(int [ setting ]) Description The ignore_user_abort() function, which was added in PHP 3.0.7 and PHP 4.0b4, sets the PHP behavior on whether a client disconnect should cause the script to be aborted. It returns the previous setting. By not specifying a setting parameter, the function will simply return the current setting without altering it. The setting of 1 indicates that user abort is on. iptcparse() Syntax array iptcparse(string iptcblock) Description The iptcparse() function, which was added in PHP 3.0.6 and PHP 4.0b4, parses a binary iptcblock into single tags and returns an array using the tag marker as an index and the tag marker's value as the value. If no IPTC data exists, the function returns false. More information regarding iptc blocks can be found at http://www.iptc.org/iptc/ leak() Syntax void leak(int bytes) Description The leak() function leaks the specified amount of memory. This function is normally used to verify the behavior of the memory manager, which automatically cleans up "leaked" memory when each request is completed. pack() PHP Developer’s Dictionary IT-SC book 147 Syntax string pack(string format, mixed [args] ) Description The pack() function returns a binary string containing args packed according to the format . The format string contains formatting codes along with an optional repeater parameter, which can be a number or an * (which indicates repeat until the end of the args ). These formatting codes are based on the codes defined in Perl. The repeat count for a, A, h, H indicates how many characters of one data argument are taken, and the @ character indicates the absolute location for the next piece of data. For all others, the repeat count specifies how many pieces of data are included and packed into the resulting binary string. The following codes are available: a— NUL-padded string A— Space-padded string h— Hex string, low nibble first H— Hex string, high nibble first c— Signed char C— Unsigned char s— Signed short (always 16-bit, machine byte order) S— Unsigned short (always 16-bit, machine byte order) n— Unsigned short (always 16-bit, big-endian byte order) v— Unsigned short (always 16-bit, little-endian byte order) i—Signed integer (machine-dependent size and byte order) I— Unsigned integer (machine-dependent size and byte order) l— Signed long (always 32-bit, machine byte order) L— Unsigned long (always 32-bit, machine byte order) N— Unsigned long (always 32-bit, big-endian byte order) V— Unsigned long (always 32-bit, little-endian byte order) f— Float (machine-dependent size and representation) PHP Developer’s Dictionary IT-SC book 148 d— Double (machine-dependent size and representation) x—NUL byte X— Back up one byte @— NUL-fill to absolute position register_shutdown_function() Syntax int register_shutdown_function(string func) Description The register_shutdown_function() function, which was added in PHP 3.0.4 and PHP 4.0b4, specifies the name of the function to be called when script processing is complete. No output to the browser is allowed in the shutdown function. serialize() Syntax string serialize(mixed value) Description The serialize() function, which was added in PHP 3.0.5 and PHP 4.0b4, returns a string containing a byte-stream representation of value that can be stored anywhere. The type and structure of the variable are maintained. serialize() handles the types integer, double, string, array (multidimensional), and object. Note that when serializing an object, only its properties are preserved. The object's methods are not serialized. sleep() Syntax void sleep(int seconds ) PHP Developer’s Dictionary IT-SC book 149 Description The sleep() function causes script processing to pause for seconds seconds. Note that you can specify an expression as the seconds value, such as (30 * 60) to indicate 30 minutes. uniqid() Syntax int uniqid(string prefix, boolean [lcg]) Description The uniqid() function returns a prefixed unique identifier based on the current time in microseconds. prefix can be up to 114 characters long. prefix is useful in creating unique identifiers across processes or machines where the function could be called at the same microsecond. If lcg is set to true, a "combined LCG" entropy will be added to the end of the return value, which should make the result even more unique. LCG stands for linear congruential generator, which is another type of psuedo-random number generator. When generating a cookie value for a user, it is recommended that you use something like md5 (unique(rand())) for maximum security. unpack() Syntax array unpack(string format, string data) Description The unpack() function extracts data from a binary string ( data ) and places it into an array according to the format parameter. See pack() for formatting code details. unserialize() Syntax mixed unserialize(string str) . function_exists(string function_name) Description The function_exists() function, which was added in PHP 3.0.7 and PHP 4.0b4, returns true if a function named function_name has been defined; otherwise, it. support. PHP Developer’s Dictionary IT-SC book 146 ignore_user_abort() Syntax int ignore_user_abort(int [ setting ]) Description The ignore_user_abort() function, which was added in PHP. Description The ignore_user_abort() function, which was added in PHP 3.0.7 and PHP 4.0b4, sets the PHP behavior on whether a client disconnect should cause the script to be aborted. It

Ngày đăng: 07/07/2014, 05:20