Switching from PHP's mysql extension to PDO. Extend class to reduce lines of code

后端 未结 2 1482
时光取名叫无心
时光取名叫无心 2021-01-16 20:30

So this is something I\'ve been meaning to get to grips with for ages. Converting a few small (single-file) applications to PDO. I can use PDO, connect to a database and run

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-16 20:58

    The problem, as I see it, is that you are hard-coding a particular error level into your application. What if you're in development and you want everything? What if you decide you want to change the level for a particular application? It would be much better to keep it as a parameter you set after the fact, or, if you're bent on subclassing it, pass an error level in as a constructor argument.

提交回复
热议问题