开发者

write a block that will not apear in the published page [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifyi开发者_如何学Gong this question so that it can be reopened, visit the help center. Closed 11 years ago.

I want to write a block for my own use only, but not to be visible when the page is read in a browser.


Maybe commenting it?

HTML:

<!-- comment... -->

PHP:

/* comment 1 */
// comment 2
#  comment 3


Something like this might work for you:

<html>
<head>
    <title>My Title</title>
</head>
<body>
<?php
/*
This is a server side comment that will not be visible on the client side.
*/
?>
</body>
</html>


I usually do it like this:

<?php
     // code for them

     if (isset($_GET['debug'])) {
         // code for me
     }
?>

When I need access to the debug code, i just browse to http://mysite.com/page.php?debug

Obviously, this isn't secure. Anybody can simply add ?debug to the URL and see your debug info. This would be something to use during initial development of a one-off script hosted locally, and is not suitable for use on a public-facing site.


You can use comments like // /* */ and # http://php.net/manual/en/language.basic-syntax.comments.php

It's the only way that visitors won't see your text blocks.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜