


Teach you step by step how to do keyword matching projects (search engines)----The seventh day, teach you how to do----
The seventh day
Xiao Shuai Shuai took it back and studied it carefully all night.
I found out that the code was actually written by myself, and there were a few more classes. Boss Yu had not copied my code, and he despised Boss Yu in his heart.
In fact, everyone has a common problem. Those who write procedures will always despise writing object-oriented, because they do not understand what object-oriented is, and it will take several years for them to write it well.
When Xiao Shuaishuai learned programming, he clearly knew that there was a concept of function and how to write a function, but in fact, even if there were hundreds of lines of code in a function, he didn’t know how to come up with multiple functions in advance, just to make an appointment. : Look how awesome I am, with hundreds of lines of code.
Although Xiao Shuaishuai despises Boss Yu in his heart, he feels very refreshed when he sees Boss Yu’s code, everything is so natural.
But he still couldn’t help but ask Boss Yu:
"Boss Yu, actually your code is the same as mine. Why do you write it like this? What are the benefits of writing it like this?"
Boss Yu said: "Well, yes, the codes are basically the same, and sometimes there are some more codes. Did you find out during the comparison process that the code I wrote is correct? Your code is summarized and categorized."
Object-oriented is actually the summary and classification of process-oriented.
It’s a pity that Xiao Shuaishuai still doesn’t understand it well. Although he is not very happy in his heart, after all, he is the boss, so he is right to listen to his words.
Xiao Shuaishuai replied: "Well, yes, then I can extend it by inheriting Source."
Boss Yu returned: "Well, yes, the inherited Source only needs to assign values to the attribute keywords inside. Isn't it very convenient? If you are not familiar with object-oriented, I suggest you learn these basics first. ".
Object-oriented: Object Oriented (OO) is a software development method. Object-oriented concepts and applications have transcended programming and software development and expanded to fields such as database systems, interactive interfaces, application structures, application platforms, distributed systems, network management structures, CAD technology, artificial intelligence and other fields. [From Baidu entry]
"Object-oriented" specifically refers to the use of design methods such as encapsulation, inheritance, and polymorphism in programming.
Boss Yu continued: "You can continue to expand one according to my method to deepen your thinking. Just the "Are you looking for it?" task."
Xiao Shuai Shuai replied: "Okay".
Xiao Shuai Shuai completed the task in less than an hour.
The requested keyword is plus size women's clothing, the address is: http://s.taobao.com/search?spm=1.7274553.1997520241.2.RsphTP&q=%C5%AE%D1%A9%B7%C4%C9% C0&refpid=420461_1006&source=tbsy&style=grid&tab=all
HTML:
<span><</span><span>dl </span><span>class</span><span>="supplement-relate"</span><span>></span> <span><</span><span>dt</span><span>></span>您是不是想找:<span></</span><span>dt</span><span>></span> <span><</span><span>dd</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?spm=a230r.1.0.0.TjhJTC&q=%D1%A9%B7%C4%C9%C0%C5%AE2014&rs=up&rsclick=1"</span><span> data-spm-anchor-id</span><span>="a230r.1.0.0"</span><span>></span>雪纺衫女2014<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%C5%AE%D1%A9%B7%C4%C9%C0%B3%A4%BF%EE&rs=up&rsclick=2"</span><span>></span>女雪纺衫长款<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%B4%F3%C2%EB%C5%AE%D1%A9%B7%C4%C9%C0&rs=up&rsclick=3"</span><span>></span>大码女雪纺衫<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%D1%A9%B7%C4%C9%C0%C5%AE%B6%CC%D0%E4&rs=up&rsclick=4"</span><span>></span>雪纺衫女短袖<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%D1%A9%B7%C4%C9%C0+%C5%AE+%B3%A4%D0%E4&rs=up&rsclick=5"</span><span>></span>雪纺衫女长袖<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%C1%AC%D2%C2%C8%B9&rs=up&rsclick=6"</span><span>></span>连衣裙<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%C5%AEt%D0%F4&rs=up&rsclick=7"</span><span>></span>女t恤<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%B4%F3%C2%EB%C5%AE%D7%B0&rs=up&rsclick=8"</span><span>></span>大码女装<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%C5%AE%D1%A9%B7%C4%C9%C0%B0%D7%C9%AB&rs=up&rsclick=9"</span><span>></span>女雪纺衫白色<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%C5%AE%D1%A9%B7%C4%C9%C0%D6%D0%D0%E4&rs=up&rsclick=10"</span><span>></span>女雪纺衫中袖<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%C5%AE%D1%A9%B7%C4%C9%C0%CC%D7%D7%B0&rs=up&rsclick=11"</span><span>></span>女雪纺衫套装<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%CE%DE%D0%E4%D1%A9%B7%C4%C9%C0%C5%AE&rs=up&rsclick=12"</span><span>></span>无袖雪纺衫女<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=%C5%AE%D1%A9%B7%C4%C9%C0%B3%A4%D0%E4%D0%C2%BF%EE&rs=up&rsclick=13"</span><span>></span>女雪纺衫长袖新款<span></</span><span>a</span><span>></span> <span><</span><span>a </span><span>trace</span><span>="relatedSearch"</span><span> href</span><span>="/search?q=2014%D1%A9%B7%C4%C9%C0+%C5%AE+%B6%CC%D0%E4&rs=up&rsclick=14"</span><span>></span>2014雪纺衫女短袖<span></</span><span>a</span><span>></span> <span></</span><span>dd</span><span>></span> <span></</span><span>dl</span><span>></span>
Xiao Shuai Shuai’s code:
<span>class</span> TaobaoRelatedSearchSource <span>extends</span><span> Source { </span><span>public</span> <span>function</span><span> __construct() { </span><span>#</span><span> code...</span> <span>$curl</span> = <span>new</span><span> ExtendedCurl(); </span><span>$content</span> = <span>$curl</span>->get("http://s.taobao.com/search?spm=1.7274553.1997520241.2.RsphTP&q=%C5%AE%D1%A9%B7%C4%C9%C0&refpid=420461_1006&source=tbsy&style=grid&tab=all"<span>); </span><span>if</span>(<span>$curl</span>-><span>hasError()){ </span><span>throw</span> <span>new</span> <span>Exception</span>(<span>$curl</span>->getError(), <span>$curl</span>-><span>getHttpCode()); } </span><span>$html</span> = str_get_html(<span>$content</span><span>); </span><span>foreach</span>(<span>$html</span>->find(".supplement-relate a[trace==relatedSearch]") <span>as</span> <span>$ele</span><span>){ </span><span>$this</span>->keywords[] = <span>$ele</span>-><span>innertext; } } }</span>
Xiao Shuai Shuai showed the code to Boss Yu and was praised by Boss Yu, which made him feel happy. However, Xiao Shuaishuai still does not understand the true meaning of object-oriented.
Shortly after Xiao Shuai Shuai was happy, he was troubled again. The reason was how to use Taobao API and how to get baby information? Where does the information come from?
Little Shuaishuai had no choice but to run to the boss again and ask for advice on how to defeat the enemy.
Boss Yu first asked him to read the Taobao API tutorial and gave him a URL: http://open.taobao.com for Xiao Shuaishuai to read by himself.
Xiao Shuai Shuai had to silently despise Boss Yu in his heart again. He asked me to go and see him. Why do you want me to see him? As soon as this strange thought came to him, Xiao Shuai Shuai quickly shook his head, trying to keep his mind clear. Keep thinking about it.
Just like that, Xiao Shuaishuai went to Taobao open platform to learn from it, and all the object-oriented things were forgotten. (0 Without actual training and understanding, I still follow the boss’s ideas 0)
PS: (Learning is a personal matter, and the project director only leads the door. Whether you can succeed or not depends on the individual. In fact, many people have this idea just like Xiao Shuaishuai, and some people will question someone’s ability. )
Wangdao SEO optimization software works on search engine optimization. My personal understanding of search engine optimization is that SEO creates and uses keyword optimization to help small and medium-sized enterprises’ websites rank higher in search engine query results to obtain the most effective user clicks. . It is based on the retrieval characteristics of search engines for web pages, so that the basic elements of website construction are suitable for the retrieval principles of search engines, so that the search engines can include as many web pages as possible and rank high in the natural retrieval results of search engines, ultimately reaching the website Promotional purposes. The main work of Wangdao search engine optimization is to optimize web content by understanding how various search engines crawl Internet pages, how to index them, and how to determine their ranking of search results for a specific keyword. , a technology that makes it in line with users' browsing habits, improves search engine rankings without damaging user experience, thereby increasing website visits, and ultimately improving the website's sales or publicity capabilities. The so-called "search engine optimization for Wangdao" is to make the website more easily accepted by search engines.
360 search engine has agents in Hebei
What are the advantages of 360 promotion
Rich resources - covering many traffic entrances such as 360 navigation, 360 search, etc., with rich display locations and display forms to meet the needs of enterprises Diverse needs. Simple operation - humanized design, fast delivery process, simple and flexible operation, you only need to open an account to achieve self-service delivery. Precise positioning - through keyword matching and delivery by time period, region, and user group, we can accurately target the target user group and display more accurate promotional information for the enterprise. Intelligent and efficient - professional statistical methods and various data reports ensure the scientificity and rigor of 360 promotion; only charging is based on results, truly achieving lower investment and higher returns!
360 search Hebei area processing: 1111

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor
