tailieunhanh - MySQL /PHP Database Applications Second Edition phần 5

Bạn cũng có thể lưu trữ các tập tin bao gồm của bạn bên ngoài của đường dẫn tài liệu máy chủ web của bạn để bảo mật hơn (kể từ khi một số máy chủ đáp ứng với phần mở rộng không rõ bằng cách in ra các tập tin - oops, là mã nguồn của bạn.) | Chapter 9 Survey 279 if arg NULL is_array arg count arg 0 do nothing elseif is_object arg result array_merge result get_object_vars arg elseif is_assoc arg result array_merge result arg else if i sc key simple i if empty arg isset result key result key arg else if key NULL user_error Argument arg was passed with no available target - aborting. n E_USER_ERROR if isset result key if is_array result key result key array result key result key arg else result key arg 280 Part 111 Simple Applications Two things are worth pointing out here. If a simple argument is encountered after we ve run out of parameter names from _simple it s added into an array by means of the last simple name. This is how a function like paragraph works. It has just one simple argument name values so a list of simple arguments passed in to the function ends up as elements in the values array paragraph One line Another line variable Yet another line becomes values array One line Another line variable Yet another line If there are no names passed in however we won t have anywhere to put any arguments that aren t associative arrays. In this case we use PHP s user_error function to raise an error. This prints out our error message and stops the script just like a normal PHP error. The user_error function is one you ll be seeing more of in later examples. Finally to clean up we take any changes to our list of default and simple arguments and pass them back to the calling function. Because the two arrays are passed in by reference changes made to them here will update the original variables. And because they re declared as static those changes will still be there the next time the function is called. defaults array_merge defaults result _defaults simple result _simple return result Changes to _defaults are merged into the original list while a new value for _simple will replace the old one. After calling parse_arguments in the image_src function like this p parse_arguments p _simple _defaults we have an

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
8    121    0    03-06-2024
15    118    0    03-06-2024
crossorigin="anonymous">
Đã 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.