Want to do a Web crawl function, the underlying use of PHP laravel framework.
Here we use the Phpquery Library to implement Web page crawling, which is not introduced here.
Need to know can Baidu, or so I pits.
Not scientific Internet can directly click on my upload download package--| how to upload ... Own Baidu Bar, the current version is phpQuery-0.9.5.386
-------------------------------------
Let's make a statement about the version I'm using:
laravel5.1;
phpQuery-0.9.5.386;
-------------------------------
began to think that as long as the entire package into the library Laravel project can be used, sure enough, the pattern Tucson broken.
Given the good line in the Laravel framework package, it is necessary to set the Laravel autoload->class map
-------
1, first in the app directory to create a new folder, named Libs (customizable)
2. (optional) consider that many libraries may be referenced later so, create a phpquery folder under Libs
3. Locate the Composer.json file under the root directory
4, find the definition of Composer.json (see my notes)
"AutoLoad": { "Classmap": [ "Database", "app/libs/phpquery"//Add me plus me ], "psr-4": { "app\\" : "app/" } ,
5. Run terminal, CD to project path, execute
Composer Dumpautoload
--------------------------
You can then use the Phpquery in the project happily, with the following simple usage:
Use Phpquery;
Phpquery::newdocumentfile (' http://www.baidu.com '); $companies = PQ (' body '); return $companies;
Note: If you want to add another third-party library, repeat the 2-5 step.
The above describes how Laravel refers to a third-party (custom) library, including aspects of the content, hoping to be interested in the PHP tutorial friends helpful.