开发者

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

开发者 https://www.devze.com 2023-03-02 05:15 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
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

精彩评论

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