BHP编译器教程

BHP编译器教程

BHP是一个WEB模版编程语言编译器,生成PHP后端代码。

最简单的Helloworld例子

编写一个hello.bhp文件

<?

$hello="hello,world";

<<hello<<$hello

 

这里我们用到一个语法

<<hello<<$hello

其中第1个<<表示模板语法开始,必须在行首。

Hello表示模版里面的变量.

第2个<<表示数据管道。

$hello表示php变量。

再编写一个hello.bht文件

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>hello</title>

</head>

<body>

{hello}

</body>

</html>

 

{hello}是模板变量定义语法。

命令行编译的时候,只要指定主文件

C:>bHPC  hello

生成的文件hello.php如下:

 
 

<?

$hello="hello,world";

?>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>hello</title>

</head>

<body>

<?php echo $hello;?>

</body>

</html>

 

然后将此php文件复制到php服务器目录,运行,显示 hello,world

下载

原文地址:https://www.cnblogs.com/stevenlaz/p/4333047.html