开发者

Is there a feature like this in PHP?

<namespace:BLOCKQUOTE id="" runat="server">

This is what I see in asp code,is there such a feature in PH开发者_运维百科P?


The runat property of asp tags simply make it possible to access the controls as data members in the server-side code. That is, you could have something like the following in your markup

<namespace:BLOCKQUOTE id="block" runat="server">

and then in your server code, you could access it as if it were a variable

block.Value="something"

Otherwise, the data member isn't accessible to the code. PHP doesn't function the same way so it doesn't have any need for the runat property. To set the value of an html control with php and assign it the value of $variable for instance, you would use

<input type="text" value="<?php echo $variable; ?>"/>

This would accomplish something similar. Essentially, there isn't a feature like that because there doesn't need to be.


In PHP the code is run at the server and the output is the HTML markup.

<?php
echo "Hello, World<br>";
?>

Should run the program with the "echo" on the server and output the Hello, World<br> to your browser (or on the command line if you run this from the command line).

So if you have some mark-up with this:

<html>
<body>
<h1> Title: Hello Silly World </h1>
<?php
echo "Hello, World<br>";
?>
</body>
</html>

You should get a similar effect to the "runat=SERVER".


no there is no such feature, there template-ting engine like smarty but no runat="server"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜