doudou0111 2016-12-29 01:48 采纳率: 0%
浏览 12

Html网站的动态文本为客户定制? PHP / HTML? [关闭]

I am in following situation:

I am Programming a Website for a small local mobile repair shop. So far so good. Problem is, the Client wants to change the text every week because of new Offers. He does not know any coding, but he can use the computer as far as Word or a text document.

My Question: Is it possible to use external Sources of text for this? For example a offer.txt which I include in the page via php?

The question is, If the Text format will be the same for example fonts or stiley applied to it, or will I encounter any problems doing so?

  • 写回答

1条回答 默认 最新

  • douqianxun8540 2016-12-29 05:26
    关注

    You can use a database(may be Mysql) to store the text, and retrieve it using sql query.I think which will the most reliable solution.

    But as you said, you can also show some text from a .txt file with the aid of PHP. The procedure is described below:-

    1. place your text file with .txt extension in the same directory where php file is located (if not, you must specify the exact path to the file in php code)

    2. In your php file add the below code :

    <?php
    $myfile = fopen("yourfile.txt", "r") or die("Unable to open file!");
    echo fread($myfile,filesize("yourfile.txt"));
    fclose($myfile);
    ?>
    

    you can format the text like this

    echo "<b>". fread($myfile,filesize("yourfile.txt"))."</b>";
    

    this line must be written after opening the file and before closing the file as done in the above example

    Don't forget to change "yourfile.txt" with your text file name

    Hope This Helps...

    评论

报告相同问题?

悬赏问题

  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系