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

WBOY
Release: 2016-07-13 10:21:14
Original
993 people have browsed it

Teach you step by step how to do a keyword matching project (search engine)----The first day, teach you how to do----

The first day

Received requirements, the requirements are as follows:

1. Collect keywords and build a keyword database.

After receiving this task, my first thought was, isn’t this simple? Start immediately to create a keyword entry interface and save it to the database. The first step was completed, and I laughed all day long. I didn’t expect that things turned out to be so simple.

Database configuration file: config.php

<span>$database_host</span> = 192.168.1.1
<span>$database_user</span> =<span> xiaoshuaishuai
</span><span>$database_password</span> =<span> xiaoshuaishuai
</span><span>$database_charset</span> = "utf-8"
Copy after login

Backend logic processing: keywords.php

<?<span>php

</span><span>include</span> "config.php"

<span>$keywords</span> = <span>$_REQUEST</span>["keywords"<span>];

</span><span>$con</span> = <span>mysql_connect</span>(<span>$database_host</span>,<span>$database_user</span>,<span>$database_password</span><span>);
</span><span>mysql_query</span>("SET NAMES '<span>$database_charset</span>'",<span>$conn</span><span>);
</span><span>mysql_select_db</span>("dict",<span>$conn</span><span>);

</span><span>foreach</span>(<span>$keywords</span> <span>as</span> <span>$keyword</span><span>){

      </span><span>//</span><span>save $keyword to database</span>
      
      <span>$sql</span> = "insert into keywords(word) values ('<span>$keyword</span>')"<span>;
      </span><span>mysql_query</span>(<span>$sql</span>,<span>$conn</span><span>);     
    
}

</span><span>mysql_close</span>(<span>$conn</span>);
Copy after login

How do search terms in Baidu search engine match promotional keywords?

Currently, Baidu promotion has three matching methods: precise, phrase, and broad. Generally speaking, the golden combination matching method is: broad matching + search term report + negative keywords. In terms of traffic, it's broad>phrase>accurate. You can set it according to your actual situation!

When searching with a search engine, if there are three keywords and you want an exact match, how should you enter them?

If you want an exact match, you need to put quotes around ABC.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/860060.htmlTechArticleTeach you step by step how to do keyword matching projects (search engines)----On the first day, teach you how to do- --- Received requirements on the first day, the requirements are as follows: 1. Collect keywords and build a keyword database. Received this...
Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!