如何使用PHP动态生成HTML页面? [英] How to generate a HTML page dynamically using PHP?

查看:108
本文介绍了如何使用PHP动态生成HTML页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面显示关于属性的信息,根据url的唯一ID,搜索mysql数据库中的ID,从该行获取所有的信息,相当标准的。

I have a page which displays info about a property, based on the unique ID from the url, searching the mysql database for that ID, getting all the info from that row etc, fairly standard really.

我想知道是否/我如何为每个数据库行创建一个html页面,因为我认为这对SEO会更好?拥有关键字而不是一个动态页面的多个页面?

I was wondering if/how I can 'create' a html page for each database row, as I'm assuming this would be better for SEO? Having multiple pages with keywords on rather than one dynamic page?

我的属性通过网站上的表单/上传系统添加到数据库中,我在考虑创建页面上传可能是最简单的,但是可以接受建议!

My properties are added to the database by a form/ upload system on the site, I was thinking creating the page on upload might be easiest, but am open to suggestions!

推荐答案

我想知道是否/可以如何创建每个数据库行的html页面

您只需创建一个 php 生成一个HTML模板,该页面上的基于文本的内容有什么变化。在该页面中,您可以通过 POST GET 获取参数(例如行ID),然后获取信息形成数据库。

You just need to create one php file that generate an html template, what changes is the text based content on that page. In that page is where you can get a parameter (eg. row id) via POST or GET and then get the info form the database.

我认为这对SEO会更好?

搜索引擎作为Google解释为 example.php?id = 33 example.php?id = 44 是不同的页面,,这种方式比单一的列表页面从SEO的角度来看,所以你只需要两个php文件( listing.php single.php ),因为更好地从 listing.php 链接这个页面。

Search Engine as Google interpret that example.php?id=33 and example.php?id=44 are different pages, and yes, this way is better than single listing page from the SEO point of view, so you just need two php files at least (listing.php and single.php), because is better link this pages from the listing.php.

额外建议:

example.php? id = 33 真的很丑陋,不是很seo友好,也许你需要一些url重写代码。像 example / properties / property-name 更好;)

example.php?id=33 is really ugly and not very seo friendly, maybe you need some url rewriting code. Something like example/properties/property-name is better ;)

这篇关于如何使用PHP动态生成HTML页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆