search
HomeBackend DevelopmentPHP TutorialHTML代码和PHP分离 的疑问

看了一下 http://123langzheng.blog.163.com/blog/static/1362078062011125111528576/

 以下举例子说明它们的用法,假设 IntegratedTemplate 类和 IntegratedTemplateExtension 类分别在 C:\php4\pear\HTML\ITX.php 和 C:\php4\pear\HTML\ITX.php 中。我们写的代码放在C:\TestPHP\PHP4\Welcome.htm 和 C:\TestPHP\HTML\Welcome.php 中。将C:\TestPHP\PHP4 在Web Server 上设成虚拟目录 /testphp 并且给与脚本执行权限,确认C:\TestPHP\HTML\Welcome.htm 无法通过远端浏览器访问。在 php.ini 里面设置 include_path = ".;C:\php4\pear"



我用的是 Zend Studio 10.0 ,php版本选的是5.4

假设 IntegratedTemplate 类和 IntegratedTemplateExtension 类分别在 C:\php4\pear\HTML\ITX.php 和 C:\php4\pear\HTML\ITX.php 中。



这个啥意思?为什么还要假设?还有 IntegratedTemplate 类和 IntegratedTemplateExtension 类在哪?
pear这文件夹是啥?

我看的教程是 《PHP从入门到精通 第二版》里面没有这方面内容啊?

难道说上面的说明已经相当充分了,只是我太笨看不懂?


回复讨论(解决方案)

1、pear 是 php 代码书写的一个类库,流行于 PHP4
由于 php5 引入了大量新特性,一些原来需要用代码书写的类,也定型并内置到 php 系统中了
所以现在去看基于 php4 的教程很是过时了
2、html 代码与 php 代码分离,统称为 模板技术
比较专业的 模板引擎是 Smarty 相比之下 IntegratedTemplate 和 IntegratedTemplateExtension 就是小儿科了
Smarty 也是用 php 代码写成的,使用时需引入
Smarty 4 已经进驻 Java,大有替代 Jstl 的趋势
3、当然,庞大的系统并不一定适合实际应用场合,所以开源的 php 项目大多都有自己的模板引擎
4、初入道还是先写混编代码比较好,这样有利于系统的学习结构化编程思想
深入后就会发现 模板技术 的优越,到时你也具备了自己写模板引擎的能力了

Statement
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
Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

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-

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

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.

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

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' =>

PHP Logging: Best Practices for PHP Log AnalysisPHP Logging: Best Practices for PHP Log AnalysisMar 10, 2025 pm 02:32 PM

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

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

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

Explain the concept of late static binding in PHP.Explain the concept of late static binding in PHP.Mar 21, 2025 pm 01:33 PM

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

Customizing/Extending Frameworks: How to add custom functionality.Customizing/Extending Frameworks: How to add custom functionality.Mar 28, 2025 pm 05:12 PM

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools