简体   繁体   English

像 PHP_EOL 一样用于制表 php 的常量

[英]constant like PHP_EOL for tabulation php

请帮忙,我怎样才能找到像 PHP_EOL 这样的常量来进行制表我的代码编写的文件有很多生成的制表和新行新行正确写入,但我有很多“\\t\\t”,请参见示例:

common.app \t/loader \t/growl \t\t/error \t/form

Ok I found solution好的,我找到了解决方案

chr(9) wrote tabulation to output file chr(9)将制表写入输出文件

Thanks!谢谢!

PHP_EOL is a Constant from Core PHP. PHP_EOL 是来自 Core PHP 的常量。 You could simply define your own Constants and use them.您可以简单地定义自己的常量并使用它们。 For example:例如:

<?php

    defined("TAB1") or define("TAB1", "\t");
    defined("TAB2") or define("TAB2", "\t\t");
    defined("TAB3") or define("TAB3", "\t\t\t");
    defined("TAB4") or define("TAB4", "\t\t\t\t");
    defined("TAB5") or define("TAB5", "\t\t\t\t\t");


    $string = "common.app"     . TAB1 . "/loader" . TAB1 . "/growl" . 
               TAB2 . "/error" . TAB1 . "/form";

I solved using css我用css解决了

<style>
.MyCSS{
    border:1px solid #FFF; 
    width:10em; 
    float:left; 
    font-weight:bold;
    }
</style>
<?php 
// here the selection query
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { ?>
<div>
<div class="MyCSS">
<?php stripslashes($row['Country']);?>
</div>
<?php echo stripslashes($row['CountryDescription'])."<br>";?> 
</div>
<div style="clear:both;"></div>
<?php } ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM