Teach you step by step how to do a keyword matching project (search engine)----On the sixth day, teach you how to do it-_PHP tutorial

WBOY
Release: 2016-07-13 10:21:09
Original
1052 people have browsed it

Teach you step by step how to do keyword matching projects (search engines)----The sixth day, teach you how to do----

The sixth day

After Xiao Shuai Shuai had a rest on Friday, he was probably too energetic. He went out for a party in two days on the weekend. He drank so much that he forgot an important thing.

Refit on Monday and go to the battlefield.

As soon as he came to the company, Xiao Shuaishuai finally remembered what he had to do and couldn’t wait to compile the meeting report (work summary).

1. Last week’s work tasks:

1) Submit keywords to the keyword database on the page

2) Import the file into the keyword dictionary

3) Automatically capture key words from the keyword database

2. Improvement of abilities

1) Learned how to read csv files

2) Learned curl

3) Learned Html Dom parse

3. Work tasks for next week:

1) Understand the application of keyword thesaurus

As soon as I wrote this, the alarm bell for the meeting came. Xiao Shuaishuai hurried to the conference room with the meeting report paper in his arms.

After 3 hours of verbal melee, the meeting finally ended.

Xiao Shuai Shuai was forced to take on the following tasks. Why did Xiao Shuai Shuai not arrange the plan well?

1. Learn how to use Taobao’s API and obtain product information based on Taobao’s API.

2. Match appropriate keywords according to the attributes of the baby.

3. Continue to follow up on the subsequent task of expanding the keyword database and organize and categorize it.

After the meeting, Boss Yu found Xiao Shuaishuai in private while smoking. Boss Yu asked Xiao Shuaishuai about the situation and said: You did a great job in the tasks last week. If you can summarize these tasks, To sum up, it would be perfect to describe it with a picture that everyone can understand.

Xiao Shuaishuai was very excited when he heard this: Picture...uh...flow chart?

Boss Yu said patiently: In addition to flow charts, there are many diagrams, such as: data flow diagrams, UML diagrams... (Speaking of these, Boss Yu couldn't stop, and Xiao Shuai Shuai was confused. )

When the smoke went out, Xiao Shuaishuai couldn't hold on anymore, so he interrupted Boss Yu's boastful talk and said: Uh... Boss Yu, what kind of picture do you recommend to use to express this summary?

Boss Yu had to stop boasting and coughing to break the embarrassment. He patted Xiao Shuai Shuai on the shoulder and said affectionately: Xiao Shuai Shuai, please go and understand firstData flow diagram, UML diagram , it actually doesn’t matter what diagram you use, as long as it can convey your thoughts...

Little Shuaishuai stared at him with his mouth gagged, as if he had an egg stuffed in his mouth. In my heart, I silently despised Boss Yu.

Data flow diagram: referred to as DFD, which graphically expresses the logical functions of the system, the logical flow of data within the system, and the logical transformation process from the perspective of data transmission and processing. It is a structured system The main expression tool for analysis methods and a graphical method used to represent software models [from Baidu entry]

UML diagram: UML (abbreviation for Unified Modeling Language) Unified Modeling Language is a language used for visual modeling of software-intensive systems. UML is a standard language for describing, visualizing, and documenting products of object-oriented development systems. Unified Modeling Language (UML) is a non-proprietary third-generation modeling and specification language. UML is an open method for specifying, visualizing, building and writing the artifacts of an object-oriented software-intensive system during the development phase. UML demonstrates a series of best engineering practices that have been proven effective in modeling large-scale, complex systems, especially at the software architecture level. UML was adopted by OMG as an industry standard. UML is most suitable for data modeling, business modeling, object modeling, and component modeling. [From Baidu entry]

When Xiao Shuaishuai went to sort out this picture, Boss Yu had already drawn these pictures in his notebook. In fact, he wanted Xiao Shuai Shuai to get in touch with the knowledge of software design.

Xiao Shuaishuai’s ideas are inconsistent. As soon as he hears about new technical knowledge, he can’t wait to get in touch with it and learn from it.

In this way, Xiao Shuaishuai finally read the concepts of data flow diagrams and UML diagrams over and over again. He may be able to memorize them, but he still cannot draw such a diagram.

When Xiao Shuaishuai was dejected and went to see Boss Yu, Boss Yu showed him the compiled pictures and codes and felt shocked. It turned out that this was the gap...

Original manuscript by Boss Yu:

<?<span>php
</span><span>class</span><span> Keyword {

    </span><span>public</span> <span>$word</span><span>;

    </span><span>public</span> <span>static</span> <span>$conn</span> = <span>null</span><span>;

    </span><span>public</span> <span>function</span><span> getDbConn(){
        </span><span>if</span>(self::<span>$conn</span> == <span>null</span><span>){
            self</span>::<span>$conn</span> = <span>mysql_connect</span>(DATABASE_HOST,DATABASE_USER,<span>DATABASE__PASSWORD);
            </span><span>mysql_query</span>("SET NAMES '".DATABASE_CHARSET."'",self::<span>$conn</span><span>);
            </span><span>mysql_select_db</span>("dict",self::<span>$conn</span><span>);
            </span><span>return</span> self::<span>$conn</span><span>;
        }
        </span><span>return</span> self::<span>$conn</span><span>;
    }


    </span><span>public</span> <span>function</span><span> save(){

        </span><span>$sql</span> = "insert into keywords(word) values ('<span>$this</span>->word')"<span>;
          </span><span>return</span> <span>mysql_query</span>(<span>$sql</span>,<span>$this</span>-><span>getDbConn());     
    }

}

</span><span>class</span><span> Source {

    </span><span>public</span> <span>$keywords</span><span>;

    </span><span>public</span> <span>function</span><span> run() {

        </span><span>foreach</span> (<span>$this</span>->keywords <span>as</span> <span>$word</span><span>) {
            </span><span>#</span><span> code...</span>
            <span>$keyword</span> = <span>new</span><span> Keyword();
            </span><span>$keyword</span>->word = <span>$word</span><span>;
            </span><span>$keyword</span>-><span>save();
        }
    }

}

</span><span>class</span> InputSource <span>extends</span><span> Source {

    </span><span>public</span> <span>function</span><span> __construct(){
        </span><span>$this</span>->keywords = <span>$_REQUEST</span>["keywords"<span>];
    }

}

</span><span>class</span> FileSource <span>extends</span><span> Source {

    </span><span>public</span> <span>function</span> __construct(<span>$filename</span><span>){
        </span><span>$file</span> = <span>fopen</span>(<span>$filename</span>,'r'<span>); 
        </span><span>while</span> (<span>$data</span> = <span>fgetcsv</span>(<span>$file</span><span>)) {
                </span><span>$this</span>->keywords[] = <span>$data</span><span>;
         }
        </span><span>fclose</span>(<span>$file</span><span>);        
    }
}

</span><span>class</span> TaobaoHotsSource <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://www.taobao.com"<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(".search-hots a[class!=more]") <span>as</span> <span>$ele</span><span>){
            </span><span>$this</span>->keywords[] = <span>$ele</span>-><span>innertext;
        }

    }
}</span>
Copy after login

Xiao ShuaiShuai had no choice but to use the wooden sword to fight monsters and upgrade. The level of this boss was too high, and Xiao ShuaiShuai couldn't resist it.

Xiao Shuai Shuai’s Q spirit is still very good. He firmly believes that one day he will become a Boss and let other newcomers challenge him.

Teach you how to do it step by step, very suitable for office workers and students. If you want to make a fortune, don’t come here, just make some phone money

Everyone has a good deck of cards in their life, but it is a pity that many people waste it. They have a deck of rich cards in their hands, but they make themselves poor.
Many people’s souls are stained with the dust of negativity, the sludge of disappointment, thoughts of poverty and backwardness, and even the seeds of resentment, so you will never be happy or rich. Poor people: Is there any secret to getting rich and doing business?
Rich man: Everything has its own internal laws. The so-called secret is actually just a little bit of it.
Ninety-nine degrees plus one degree, the water will boil. The difference between boiling water and warm water is this degree. The reason why some things are so different is often because of this trivial degree. I saw such a thing in the newspaper.
Two laid-off female workers each opened a breakfast shop on the roadside, selling steamed buns and camellia oleifera. One business gradually prospered, and the other closed the stall after 30 days. It is said that the reason was an egg problem.
Whenever a customer comes to the business that is gradually booming, they always ask if they want to beat one egg or two eggs in the oil tea; the one that is failing asks if they want it. Two different questions will always make the first house sell more eggs. The more eggs you sell, the greater the profit will be, and you can afford to pay all the expenses, and the business will continue. Those who sell fewer eggs will make less profit. After removing the expenses, they will not make any money, so the stall has to be closed down. The difference between success and failure is just one egg.
Ninety-nine percent of the world-famous Coca-Cola is water, sugar, carbonic acid and *, and the composition of all beverages in the world is probably the same. However, there is 1% of things in Coca-Cola that others absolutely have. It is said that it is this mysterious 1% that makes it have a net profit of more than 400 million U.S. dollars every year, while other brands of drinks are satisfied with an annual income of 80 million U.S. dollars.
In this world, the distance between success and failure is only a little bit, and the so-called secret is only this little bit, but this little thing is the most precious, and many people have to spend many failures to get it back. , and then move towards success. Poor person: If you know the secret of a certain business, will it be easier to succeed in this project?
Rich man: All businesses have their own little secrets. No one will tell others this little secret, because some of them cannot be put on the table. In addition, they are afraid that others will learn from them, so they all list them. Incorporated into the ancestral secret recipe. A friend from that clinic told me that in order for a clinic to make money, in principle: first, it must be cheap, and second, it must be effective. But if you follow this principle to the letter, you won’t make any money. Since it's cheap, you can't charge too high. If it's effective, you can treat the disease once. In this way, there will be very little money left except for the management of the administrative department, rent, employee wages, and various social charges... It's better to save money early. close the door. Whatever industry you want to engage in, you must first make friends with people who are engaged in this industry or work with them as employees. If you work hard, you can learn this ancestral secret recipe. This is much more cost-effective than losing a lot of time and slowly exploring in practice.
The small boss does things, the middle boss makes the market, and the big boss makes the momentum!
Many of us make money with physical strength, many of us make money with technology, few of us make money with knowledge, and very few of us make money with wisdom. In the age of wealth, there are too few smart people, and those who are smart and can seize business opportunities are even rarer. As long as we use our brains and wisdom, we can seize the opportunity and become the master of wealth.

Teach you step by step how to use the GHOST XP system!

Okay, give me the red flag,

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/860922.htmlTechArticleTeach you step by step how to do keyword matching projects (search engines)----On the sixth day, teach you how to do- --- On the sixth day, Xiao Shuai Shuai was probably too energetic after resting on Friday, so he went on a party in two days on the weekend...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template