Class libraries that allow PHP programming to get twice the result with half the effort. When developing a website using php, using the object-oriented method can indeed improve the code reuse rate and reduce code redundancy. What is more friendly for beginners is that most of the PHP development websites need to use php to develop websites. using object-oriented methods can indeed improve code reuse rate and reduce code redundancy. What is more friendly to beginners is that most of the class libraries required by PHP Development websites have excellent class libraries on the Internet. As a programmer, the wheel cannot be repeatedly created, so I sort out the class libraries that I usually use and hope to be useful to my PHP study webmaster friends.
I. collection class library, snoopy. class. php. (Please download the class library on Baidu without duplicate names)
Collection is essential for most webmasters. Many webmasters may directly use the cms built-in collection functions such as dedecms, but sometimes the website does not need to use the cms or cms built-in collection functions to meet our needs. You can use this collection class library. It is easy to use.
Demo:
// Load the class library file include ("snoopy. php ");
// Page address to be collected
$ Url = "http://www.www.shlongyingjixie.com ";
$ Snoopy = new Snoopy;
// Capture the page
$ Snoopy-> fetch ($ url );
// Output the html of the captured page
Echo $ snoopy-> results;
Next, use a regular expression to match the content you need. In this way, the collection is complete. Easy!
II. image processing class library, PHPThumb, (github.com/masterexploder/PHPThumb ). Note that this class library is named phpthumb with the same name as it is case-sensitive, so pay attention to it when searching documents.
In the process of website construction, there are a huge number of images to be processed. it is very tedious to use the php image function to process images. It is very difficult for new users to master. Now we can use the PHPThumb class library to process images, including image size adjustment, image capturing, Image watermarking, and image rotation.
Demo:
// Load the class library file
Require_once 'path/to/ThumbLib. inc. php ';
// Instantiate the class library. the address of the image you want to process can be a network address or a local address.
$ Thumb = PhpThumbFactory: create ('http: // www.shlongyingjixie.com /');
// Scale down the image to a maximum width of PX or a maximum of px. when only one parameter is input, the maximum width is limited.
$ Thumb-> resize (100,100 );
// Reduce the image proportional ratio to the original percentage. for example, 50 is the original 50%.
$ Thumb-> resizePercent (50 );
// Intercept a 175px * 175px Image. Note that this is the intercept. the excess part is directly cropped, not forcibly changed.
$ Thumb-> adaptiveResize (175,175 );
// Extract a PX * px image from the image center.
$ Thumb-> cropFromCenter (200,100 );
// The first two parameters are the coordinates X and Y in the upper-right corner of the image to be extracted. The following two parameters are the width and height of the image to be solved.
$ Thumb-> crop (100,100,300,200 );
// Reverse the image clockwise to 180 degrees
$ Thumb-> rotateImageNDegrees (180 );
There are more functions in this class library. if you need to process images when developing a PHP website, read the documentation of this class library to ensure that you can process images easily, you no longer have to deal with the dozens of annoying php image processing functions! Reprinted please note: http://www.shlongyingjixie.com
Bytes. What is more friendly for beginners is that most of the PHP Development website needs...