Beginning PHP5, Apache, and MySQL Web Development split phần 10 doc

81 304 0
Beginning PHP5, Apache, and MySQL Web Development split phần 10 doc

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

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Function Description disk_free_space(directory) Returns the amount of free space in the named directory. disk_total_space(directory) Returns the amount of space in the named directory. diskfreespace(directory) Equal to disk_free_space(), returns the amount of free space in the named directory. getcwd() Returns the name of the current directory. fclose(file_pointer) Closes the named file. feof(file_pointer) Verifies whether or not the end of file has been reached for the named file. fflush(file_pointer) Flushes the output to a file. fgetc(file_pointer) Returns the next character listed in the named file. fgetcsv(file_pointer, length[, Returns the next line in the named file. delimiter]) fgets(file_pointer, length) Returns a line of up to (length–1) in the named file. fegtss(file_pointer, length[, Returns a line of up to (length–1) in the named allowable_tags]) file, while removing all tags except those specified. file(filename[, usepath]) Returns an entire file in an array format, with each line representing a new value in the array. file_get_contents(filename) Reads the entire file contents into a string. file_exists(filename) Verifies whether the named file exists. fileatime(filename) Returns the last time the named file was accessed. filectime(filename) Returns the last time the named file was changed (in UNIX timestamp format). filegroup(filename) Returns the owner of the named file’s group. fileinode(filename) Returns the named file’s inode number. filemtime(filename) Returns the last time the named file was modified. fileowner(filename) Returns the owner of the named file. fileperms(filename) Returns the permissions associated with the named file. 718 Appendix C 26_579665 appc.qxd 12/30/04 8:20 PM Page 718 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description filesize(filename) Returns the size of the named file. filetype(filename) Returns the type of the named file. flock(file_pointer, operation[, Locks or unlocks the named file. wouldblock]) fnmatch(pattern, exp) Searches for a filename that matches the named parameters. fopen(filename, mode[, usepath]) Opens the named file. fpassthru(file_pointer) Returns all remaining data in the named file. fputs(file_pointer, string[, Equal to fwrite(), writes the named string to length]) the named file. fread(file_pointer, length) Reads the named file up to the named length. fscanf(handle, format[, var1, Parses input based on the named format from var2 ]) the named file. fseek(file_pointer, offset[, start]) Moves the file pointer in the named file by named offset spaces from start. fstat(file_pointer) Returns information about named file. ftell(file_pointer) Returns the position of the file pointer in the named file. ftruncate(file_pointer, size) Truncates the named file to the named size. fwrite(file_pointer, string Equal to fputs(), writes the named string to [, length]) the named file. glob(string) Finds path names that match the named string. is_dir(filename) Verifies whether the named file is a directory. is_executable(filename) Verifies whether the named file is an executable. is_file(filename) Verifies whether the named file is a file. is_link(filename) Verifies whether the named file is a link. is_readable(filename) Verifies whether the named file is readable. is_writeable(filename) Verifies whether the named file is writeable. is_uploaded_file(filename) Verifies whether the named file has been uploaded using HTTP POST. link(target, link) Creates a new link. linkinfo(path) Returns all information about the named link. Table continued on following page 719 PHP5 Functions 26_579665 appc.qxd 12/30/04 8:20 PM Page 719 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description lstat(filename) Returns information about named file. mkdir(pathname, mode) Creates a directory based on specified path name and mode. move_uploaded_file(filename, Moves the named file to a different directory. destination) opendir(path) Opens the named directory. parse_ini_file(filename) Parses the named configuration file. pathinfo(path) Returns information about the named path. pclose(file_pointer) Closes the named file pointer to a pipe. popen(command, mode) Opens a pipe with the named command. readdir(directory) Reads the named directory and returns the next entry. readfile(filename[, usepath]) Reads the named file. readlink(path) Reads the named link and returns the target. realpath(path) Returns the absolute path. rename(name, newname) Renames the named file. rewind(file_pointer) Moves the pointer to the beginning of the file stream. rewinddir(directory) Moves the pointer to the beginning of the directory and resets the directory stream. rmdir(directory) Removes the named directory. scandir(directory[, sort_order]) Lists the files and directories in the named path. set_file_buffer(file_pointer, Sets the file buffer for named file. buffer) stat(filename) Returns information about the named file. symlink(target, link) Creates a symbolic link. tempnam(directory, prefix) Creates a temporary file in the named directory. tmpfile() Creates a temporary file. touch(filename[, time]) Sets the time the named file is modified. umask(mask) Modifies the current umask. unlink(filename) Deletes the named file. 720 Appendix C 26_579665 appc.qxd 12/30/04 8:20 PM Page 720 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Error Handling and Logging Functions These functions can help you view and use errors to debug programs or alert you to potential problems in your scripts. Function Description debug_backtrace() Generates a backtrace and returns the information in an array format. debug_print_backtrace() Displays a generated backtrace. error_log(message, message_type[, Adds an error message to the server’s log, and dest, extra_headers]) anywhere else depending on the message type as defined in the given parameter. Message type 0 sends a message to PHP’s system logger, type 1 sends an e-mail to the address specified in the dest parameter, type 2 sends a remote debugging message to the IP address or hostname specified in the dest parameter, and type 3 appends the error message to the file specified in the dest parameter. error_reporting([level]) Determines which PHP errors will be displayed. restore_error_handler() Restores error handler functions. restore_exception_handler(function) Restores an exception handler function. set_error_handler(error_handler) Sets an error handler function. set_exception_handler(function) Sets a user-defined exception handler function. trigger_error(error_message[, Same as user_error(), displays a user-level error_type]) error message. user_error(error_message[, Same as trigger_error(), displays a error_type]) user-level error message. HTTP Functions These functions work with the HTTP protocol. Function Description header(string) Outputs the named HTTP header. headers_list() Returns an array containing the headers that will be sent. headers_sent() Verifies whether HTTP headers have been sent. Table continued on following page 721 PHP5 Functions 26_579665 appc.qxd 12/30/04 8:20 PM Page 721 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description setcookie(name, [value, expiration, Sends a cookie to the user based on the named path, domain, secure]) parameters. setrawcookie(name, [value, Sends a cookie to the user without url expiration, path, domain, secure]) encoding it first. Image Functions The following PHP functions enable you to manipulate and create images directly from your PHP code. Please note that you may need to have the GD library, which enables you to create dynamic images, installed to enable some of these functions. You can download GD from www.boutell.com/gd/. Function Description exif_imagetype(filename) Returns the type of named image file. exif_read_data(filename) Reads the EXIF headers in a JPEG or TIFF image, useful for reading digital images. exif_thumbnail(filename[, width, Reads the embedded thumbnail image of a height, type]) JPEG or TIFF image. gd_info() Returns information about the currently installed GD library. getimagesize(filename, [image_info]) Returns the size of the named file. image_type_to_mime_type(type) Gets the MIME-type for the named image type. image2wbmp(image[, filename]) Outputs the image directly to a browser. imagealphablending(image, blendmode) Sets the blending mode for the named image. imageantialias(image, on_off) Toggles antialiasing on and off for the named image. imagearc(name, cx, cy, width, Draws a partial ellipse based on named height, start, end, col) parameters. imagechar(name, font, x, y, c, col) Draws a character horizontally based on named parameters. imagecharup(name, font, x, y, c, col) Draws a character vertically based on named parameters. imagecolorallocate(name, red, green, Allocates a color for the named image and blue) returns an identifier. imagecolorallocatealpha(name, red, Similar to imagecolorallocate(), except green, blue, transparent) allows the color to display at a certain level of transparency. 722 Appendix C 26_579665 appc.qxd 12/30/04 8:20 PM Page 722 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description imagecolorat(name, x, y) Indicates the color index of the pixel at the named coordinates. imagecolorclosest(name, red, green, Returns the closest color in the palette of the blue) named image. imagecolorclosestalpha(name, red, Similar to imagecolorclosest(), except takes green, blue, alpha) into account the alpha (transparency) level. imagecolorclosesthwb(name, red, Similar to imagecolorclosest(), except also green, blue) looks at hue, whiteness, and blackness. imagecolordeallocate(name, red, Opposite of imagecolorallocate(), green, blue) deallocates the color for the named image. imagecolorexact(name, red, green, Returns the exact color in the palette of the blue) named image. imagecolorexactalpha(name, red, Similar to imagecolorexact(), except takes green, blue, alpha) into account the alpha level. imagecolorresolve(name, red, green, Returns either the index of the exact color or blue) the closest color available in the palette of the named image. imagecolorresolvealpha(name, red, Similar to imagecolorresolve(), except green, blue, alpha) takes into account the alpha level. imagecolorset(name, index, red, Sets the color for the palette of the named file. green, blue) imagecolorsforindex(name, index) Returns value for red, blue, and green for the specified index. imagecolorstotal(name) Returns the number of available colors in the palette of the named image. imagecolortransparent(name[, color]) Sets the named color as transparent in the named image. imagecopy(dest_name, source_name, Copies an image based on named parameters. dest_x, dest_y, source_x, source_y, source_width, source_height) imagecopymerge(dest_name, Similar to imagecopy(), but copies an image source_name, dest_x, dest_y, based on named parameters including percent source_x, source_y, source_width, (when set to 100, acts identically to source_height, pct) imagecopy()). imagecopymergegray(dest_name, Similar to imagecopymerge(), except copies source_name, dest_x, dest_y, image in grayscale. source_x, source_y, source_width, source_height, pct) Table continued on following page 723 PHP5 Functions 26_579665 appc.qxd 12/30/04 8:20 PM Page 723 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description imagecopyresampled(dest_name, Copies and resizes a resampled image based source_name, dest_x, dest_y, on the named parameters. source_x, source_y, dest_width, dest_height, source_width, source_height) imagecopyresized(dest_name, Copies and resizes an image based on named source_name, dest_x, dest_y, parameters. source_x, source_y, dest_width, dest_height, source_width, source_height) imagecreate(width, height) Creates a new image based on named width and height. imagecreatefromgd2(name) Creates a new image from a GD file or URL. imagecreatefromgd2part(name, x, y, Creates a new image from a part of a GD file or width, height) URL. imagecreatefromgd(name) Creates a new image from a GD file or URL. imagecreatefromgif(name) Creates a new image from the named GIF file. imagecreatefromjpeg(name) Creates a new image from the named JPEG or JPG file. imagecreatefrompng(name) Creates a new image from the named PNG file. imagecreatefromstring(name) Creates a new image from an image stream in the named string. imagecreatefromwbmp(name) Creates a new image from named file or URL. imagecreatefromxbm(name) Creates a new image from named file or URL. imagecreatefromxpm(name) Creates a new image from named file or URL. imagecreatetruecolor(x_size, y_size) Returns an image identifier based on a black image according to the named parameters. imagedestroy(name) Deletes the named image. imageellipse(name, cx, cy, width, Draws an ellipse based on the named height, color) parameters. imagefill(name, x, y, color) Fills the entire image with one color based on the named parameters. imagefilledarc(name, cx, cy, width, Draws a filled partial ellipse based on the height, start, end, color, style) named parameters. imagefilledellipse(name, cx, cy, Draws a filled ellipse based on the named width, height, color) parameters. 724 Appendix C 26_579665 appc.qxd 12/30/04 8:20 PM Page 724 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description imagefilledpolygon(name, points, Draws a filled polygon based on the named num_of_points, color) parameters. imagefilledrectangle(name, x1, y1, Draws a filled rectangle based on the named x2, y2, color) parameters. imagefilltoborder(name, x, y, Fills the entire image with a color and outlines border_color, color) it with a border color, based on named parameters. imagefontheight(font) Returns the height of the named font in pixels. imagefontwidth(font) Returns the width of the named font in pixels. imagegammacorrect(name, inputgamma, Corrects the gamma levels in a GD image. outputgamma) imagegd2(name[, filename, Outputs the named GD file to the browser chunk_size, type]) based on the named parameters. imagegd(name[, filename]) Sends the named GD file to the browser. imagegif(name[, filename]) Sends the named GIF image to another file or to a browser as the named image. imageinterlace(name[, interlace]) Toggles whether interlacing is on or off for the named image. imageistruecolor(name) Returns whether or not an image is truecolor. imagejpeg (name[, filename, Sends the named JPEG image to another file or quality]) to a browser as the named image. imageline(name, x1, y1, x2, y2, Draws a solid line based on the named color) parameters. imageloadfont(filename) Loads the named font. imagepallettecopy(destination, Copies the named color palette. source) imagepng(name[, filename]) Sends the named PNG image to another file or to a browser as the named image. imagepolygon(name, points, Draws an empty polygon based on the named num_of_points, color) parameters. imagepsbbox(text, font, size, space, Returns the coordinates for a text box using a width, angle) PostScript font, based on named parameters. imagepscopyfont(font_index) Makes a copy of an already loaded PostScript font. imagepsencodefont(encoding_file) Loads the named encoding vector for a PostScript font. Table continued on following page 725 PHP5 Functions 26_579665 appc.qxd 12/30/04 8:20 PM Page 725 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description imagepsextendfont(font_index, extend) Extends a PostScript font. imagepsfreefont(font_index) Frees the named PostScript font from memory. imagepsloadfont(filename) Loads the named PostScript font file. imagepsslantfont(font_index, slant) Slants the named PostScript font. imagepstext(name, text, font, size, Writes a text string using the named PostScript foreground_color, background_color, font and based on the named parameters. x, y[, space, tightness, angle, antialias]) imagerectangle(name, x1, y1, x2, y2, Draws an empty rectangle based on the named color) parameters. imagerotate(name, angle, color) Rotates an image based on the named parameters. imagesavealpha(name, flag) Sets the flag to save with the image’s alpha information. imagesetbrush(name, brush) Sets the brush for line drawing. imagesetpixel(name, x, y, color) Draws a pixel based on the named parameters. imagesetstyle(name, style) Sets the style for line drawing. imagesetthickness(name, thickness) Sets the thickness for line drawing. imagesettile(name, tile) Sets the tile image for fill functions. imagestring(name, font, x, y, Draws a horizontal string based on the named string, color) parameters. imagestringup(name, font, x, y, Draws a vertical string based on the named string, color) parameters. imagesx(name) Determines the width of the named image. imagesy(name) Determines the height of the named image. imagetruecolortopallette(name, Converts a true color image to a color palette dither, colors) based on the named parameters. imagettfbbox(size, angle, Draws a text box using the named TrueType font_filename, text) font and based on the named parameters. imagettftext(name, size, angle, x, Writes a text string using the named TrueType y, color, font_filename, text) font. imagetypes() Displays the image types supported by the PHP version currently being used. iptcembed(data, filename) Embeds International Press Telecommunica- tions Council (IPTC) data into a JPEG file. 726 Appendix C 26_579665 appc.qxd 12/30/04 8:20 PM Page 726 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description iptcparse(iptcblock) Parses an IPTC block into tags. jpeg2wbmp(jpegfilename, wbmpfilename, Converts a JPEG file into a WBMP file. height, width, threshold) png2wbmp(pngfilename, wbmpfilename, Converts a PNG file into a WBMP file. height, width, threshold) read_exif_data(filename) Displays any EXIF headers from a JPEG file. Mail Functions Use these functions to send mail directly from your PHP script. Function Description ezmlm_hash(addr) Displays the hash value used by EZMLM scripts. mail(to, subject, message[, headers]) Sends mail based on the named parameters. Mathematical Functions These functions allow you to perform mathematical calculations on your data while still in the PHP code. Function Description abs(number) Calculates the absolute value of a number. acos(argument) Calculates the arc cosine in radians. asin(argument) Calculates the arc sine in radians. atan(argument) Calculates the arc tangent in radians. atan2(x, y) Calculates the arc tangent of x and y. base_convert(number, Converts a number based on the named parameters. startbase, endbase) bindec(binary_string) Converts a binary string to a decimal, the opposite of decbin(). ceil(number) Rounds fractions to next highest integer. cos(argument) Calculates the cosine in radians. decbin(number) Converts a decimal to a binary string, the opposite of bindec(). Table continued on following page 727 PHP5 Functions 26_579665 appc.qxd 12/30/04 8:20 PM Page 727 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com [...]... (1970-2069) Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com E MySQL Quick Reference This appendix lists some quick reference notes for your use These topics are covered in more depth in Chapter 3 and on the MySQL Web site at www .mysql. com Database Manipulation Commands Use the following commands to create and make changes to your database and tables Command What It Does CREATE... between 0 and 1 log(argument) Calculates the natural log log10(argument) Calculates the base 10 log max(num1, num2, ) Calculates the maximum of listed values min(num1, num2, ) Calculates the minimum of listed values mt_getrandmax() Calculates the maximum random value from the mt_rand() function mt_rand([min, max]) Generates a Mersenne Twister random value mt_srand(seed) Seeds the Mersenne Twister random... allow PHP code to execute commands directly from the script Function Description escapeshellarg(arg) Escapes a string to be used as a shell argument escapreshelllcmd(cmd) Escapes shell metacharacters in the named command exec(command[, array, return_var]) Executes the named command and returns the last line of results passthru(command[, return_var]) Executes the named command and returns the raw output... env [, array other_options)]]]) Executes the given command according to the given parameters proc_terminate(process) Terminates a process opened by the proc_open() function shell_exec(command) Executes a command through the shell system(command[, return_var]) Executes the named command and returns all the output 735 Appendix C Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Spelling... the MySQL server mysql_ list_fields(database, table[, link_id]) Lists the fields in the named database and table mysql_ list_processes([link_id]) Lists the processes mysql_ list_tables(database) Lists the tables in the named database mysql_ num_fields(result) Shows the number of fields in the result from a previous query mysql_ num_rows(result) Shows the number of rows in the result from a previous query mysql_ pconnect([hostname[:port]... parameters Similar to mysql_ connect() PHP5 Functions Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Function Description mysql_ ping([link_id]) Pings the server connection to verify the connection is working properly mysql_ query(query[, link_id]) Executes the named query mysql_ real_escape_string(string[, link_id]) Escapes a string to be used in the query, and takes into account... connection mysql_ result(result, row[, field]) Obtains the data located in the named field/ row of the results mysql_ select_db(database[, link_id]) Selects the named database and makes it current mysql_ stat([link_id]) Gets the current system status mysql_ thread_id([link_id]) Returns current connection thread ID mysql_ tablename(result, index) Returns the table from which the result was obtained mysql_ unbuffered_query(query[,... results mysql_ db_name(result, row [,field]) Gets data for result mysql_ db_query(database, query[, link_id]) Executes the named query on the named database and returns results mysql_ errno([link_id]) Displays the error number for the previous query mysql_ error([link_id]) Displays the error message for the previous query mysql_ escape_string(string) Escapes the named string for use in a query mysql_ fetch_array(result... the MySQL client information mysql_ get_host_info([link_id]) Returns information about the server host mysql_ get_proto_info([link_id]) Returns the protocol information mysql_ get_server_info([link_id]) Returns information about the server mysql_ info([link_id]) Gets information about the previous query mysql_ insert_id([link_id]) Returns the ID value of the most recently inserted auto_increment field mysql_ list_dbs([link_id])... mysql_ affected_rows([link_id]) Returns the number of rows of records affected by the previous command mysql_ client_encoding() Returns the character set used by the current connection mysql_ close([link_id]) Closes the active connection mysql_ connect([hostname[:port] [:/path/to/socket], username, password]) Opens the connection to the server based on the named parameters Similar to mysql_ pconnect() mysql_ data_seek(result_id, . Restores error handler functions. restore_exception_handler(function) Restores an exception handler function. set_error_handler(error_handler) Sets an error handler function. set_exception_handler(function). values. mt_getrandmax() Calculates the maximum random value from the mt_rand() function. mt_rand([min, max]) Generates a Mersenne Twister random value. mt_srand(seed) Seeds the Mersenne Twister random. named command. exec(command[, array, Executes the named command and returns the last return_var]) line of results. passthru(command[, return_var]) Executes the named command and returns the raw output. proc_close(process)

Ngày đăng: 13/08/2014, 12:21

Từ khóa liên quan

Mục lục

  • Beginning PHP5, Apache, and MySQL Web Development

    • Cover

    • Contents

    • Part I: Getting Started

      • Chapter 1: Configuring Your Installation

        • Projects in This Book

        • Brief Intro to PHP, Apache, MySQL, and Open Source

          • A Brief History of Open Source Initiatives

          • Why Open Source Rocks

          • How the Pieces of the AMP Module Work Together

            • Apache

            • PHP

            • MySQL

            • AMP Installers

            • Foxserv

            • PHPTriad

            • XAMPP

            • Configuring Your Apache Installation

              • Testing Your Installation

              • Customizing Your Installation

              • Adding PHP to the Equation

              • Document Root

              • Configuring Your PHP Installation

                • Testing Your Installation

                • Customizing Your Installation

                • Configuring PHP5 to Use MySQL

                • Configuring Your MySQL Installation

                  • Testing Your Installation

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan