PHP 5/MySQL Programming- P46

PHP 5/MySQL Programming- P46:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 203 element of the array. This is especially useful when your text file contains data because each line in my data file represents one individual s data. The file command is so easy you might be tempted to use it all the time. The command loads the entire file into memory so you should only use it for relatively small files. When you use the fgets technique you only need one line from the file in memory at a time so the fgets method can be effectively used on any size file without affecting performance. Using file on a very large file can be extremely slow. Splitting a Line into an Array and to Scalar Values You might recall the split function from chapter 5 Better Arrays and String Handling. This function separates string elements based on some delimiter. I use the split function inside a foreach loop to break each line into its constituent values. However I really don t want an array in this situation. Instead I want the first value on the line to be read into the name variable and the second value stored in email. The list function allows you to take an array and distribute its contents into scalar non-array variables. In this particular situation I never stored the results of the split function in an array at all but immediately listed the contents into the appropriate scalar variables. Once the data is in the variables you can easily interpolate it into a mail-merge message. The next obvious step for this program is to automatically send each message as T an e-mail. PHP provides a function called mail which makes it quite easy to 1 1 add this functionality. However the function is dependent on how the server is set up and doesn t work with equal reliability on every server. Also there are good and not-so-good reasons to send e-mail through a program. It s completely legitimate to send e-mails to people when they request it or to have a program send you e-mails when certain things happen. For example my own more secure version of the tester program sends an .

Không thể tạo bản xem trước, hãy bấm tải xuống
21    15    1    21-03-2023
12    146    1    21-03-2023
Đã 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.