php中避免数据库内容重复_如何避免PHP中的问题

php中避免数据库内容重复

  1. Don’t try to do everything at once. Write a little bit of code, then test it. Write a little bit more, and test it again. Don’t start writing a full page of code and expect it to run. When errors happen, it’s a lot easier to solve them if you know where they are happening.

    不要尝试一次做所有事情。 编写一些代码,然后对其进行测试。 多写一点,然后再次测试。 不要开始编写一整页的代码并期望它能运行。 当错误发生,它是一个更容易解决这些问题,如果你知道它们的发生。

    Put comment “traffic cones” in your code to narrow down problem areas. Comments in PHP are exactly the same as those in CSS: i.e.

    在您的代码中添加注释“交通锥”以缩小问题区域。 PHP中的注释与CSS中的注释完全相同:即

    <?php This code will be run;
    /* this code will be ignored (multiple lines) */
    // this code (a single line) will be ignored too
    # this code (again on a single line) will also be ignored
    ?>

    If you are taking a class with me, I will not respond to cries of “it doesn’t work”. Before I can help you I expect you to tell me where the code doesn’t work, by eliminating suspect code inside comments. In doing so, you’re likely to find the cause of the problem yourself.

    如果您要和我一起上课,我不会回应“这没用”的呼声。 在帮助您之前,我希望您通过消除注释中的可疑代码来告诉我代码在哪些地方无效。 这样,您很可能会自己找到问题的原因。

    Keep in mind that the PHP parser is sometimes inaccurate when reporting the locations of errors. Sometimes it will report “Error on line 1” when the error isn’t on line 1 at all (in fact this error usually indicates that a brace has not been closed correctly).

    请记住,报告错误位置时,PHP解析器有时不准确。 有时当错误根本不在第1行时,它会报告“第1行错误”(实际上,此错误通常表示支架未正确关闭)。

    Close code correctly. Problems coding HTML are usually due to incorrectly written tags and incorrectly closed tags. If this is the source of most of your errors in HTML, the same problems will continue to haunt you when coding PHP.

    正确关闭代码。 HTML编码问题通常是由于标签写得不正确和标签关闭不正确所致。 如果这是大多数HTML错误的根源,则在编写PHP时,同样的问题将继续困扰您。

翻译自: https://thenewcode.com/108/How-To-Avoid-Problems-In-PHP

php中避免数据库内容重复

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值