TAILIEUCHUNG - Advanced PHP Programming- P12

Tham khảo tài liệu 'advanced php programming- p12', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 528 Chapter 21 Extending PHP Part I In most functions you are handed a resource handle zval and you need to extract the actual resource for it. Fortunately doing so is very easy. If you are looking in a single list you can use the following macro ZEND_FETCH_RESOURCE void rsrc_struct rsrc_struct_type zval zval_id int default_id char name int rsrc_list These are the arguments of ZEND_FETCH_RESOURCE rsrc_struct is the actual pointer you want the resource data to be stored in. rsrc_struct_type is the type of struct the resource is for example FILE . zval_id is a zval of resource type that contains the resource ID. default_id is an integer that specifies the default resource to use. A common use for this is to store the last accessed resource ID in an extension s if a function that requires a resource does not have one passed to it it simply uses the last resource ID. If -1 is used no default is attempted. name is a character string that is used to identify the resource you were seeking. This string is used only in information warning messages and has no technical purpose. rsrc_list is the list that should be searched for the resource. If the resource fetch fails a warning is generated and the current function returns NULL. The following is the function pfgets which reads a line from a file resource created by pfopen PHP_FUNCTION pfgets char out int length 1024 zval rsrc FILE fh if zend_parse_parameters ZEND_NUM_ARGS TSRMLS_CC r l rsrc length FAILURE return ZEND_FETCH_RESOURCE fh FILE rsrc -1 Persistent File Handle persist out char emalloc length fgets out length fh RETURN_STRING out 0 Extension Basics 529 Returning Errors Generating procedural errors in extension code is almost identical to generating errors in PHP. Instead of calling trigger_error in PHP you can use zend_error in C. zend_error has the following API zend_error int error_type char fmt . error_type is the full range of errors enumerated in Chapter 3 Error Handling. Otherwise the API is .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.