在php中格式化从文件显示的文本 [英] Formatting Text displayed from file in php

查看:83
本文介绍了在php中格式化从文件显示的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的代码中,所有内容均正常运行
我想格式化页面上显示的文本
我正在读取的文件已经格式化,如正确的缩进,间距等.
但是它不显示文件中存在的选项卡

我该怎么办?

In the below code all things are working properly
I wants to format the text displayed on my page
The file which I am reading is already formatted like proper indentation, spacing, etc.
But it is not displaying tabs that are present in file

What should I do?

<?php
          $catid = $_GET['catid'];
          $progid = $_GET['progid'];

          $con = mysql_connect("localhost","username","password");
          mysql_select_db("DB Name", $con);

          $progname = mysql_query("SELECT * FROM progs WHERE ProgId=$progid And CategoryId=$catid");
          $fnames = mysql_fetch_array($progname);

          $filename="Java/" . $fnames['ProgName'];
          $handle = fopen($filename, "r");
          $contents = fread($handle, filesize($filename));
          fclose($handle);
          $content = nl2br($contents);
          echo $content;

          mysql_close($con);
?>

推荐答案

catid =
catid =


_GET [' catid'];
_GET['catid'];


程序 =
progid =


这篇关于在php中格式化从文件显示的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆