PHP中静态页处理动态内容的思路
近碰到一个问题,新闻系统里所有新闻是生成静态的,但是我要在静态页里显示访问次数等动态内容,左思右想,没有好的解决方法。今天猛然一想,是不是能够通过框架页来解决呢?
总结的基本思路如下:
首先打开一个类似 20050120.html的静态页,里面显示了新闻等内容,同时里面还包含访问次数,比如下面的内容:
来源:未知 发布时间:2005-01-20 访问次数:21
那么我就把以上的内容包含在一个PHP程序里,然后把静态页里用iframe来调用这个页面。
但是现在又有了新问题,我如何把这个静态页的地址和相应的变量提交给这个框架页进行处理呢?
问了高手,使用JS来处理:
比如框架页id为iframe,在大页iframe").form1.hidId='20050120'"
那么我如何获取这个 hidId='20050120'" 呢,还需要使用js,我的思路是使用js里获取本页URL的方法,然后通过正则表达式进行提取,比如我的静态页的名字为 20050120.html,那么我就把20050120提取出来,然后再把这个值传递给 hidID,那么再就把值传递给了框架页,对应的PHP程序就能进行处理了,并打印相应的结果。
我这种方式我没有具体去实现,不过基本思路有了。
肯定有其他的方法,比如xmlhttp,只是目前知识有限,无法实现,如果有高手有更好的解决方法,请不吝告知!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
