如果服务器上的PHP版本是5.2,我该如何使用mysqli-> fetch_all

I have developed a sample in latest PHP 5.3 and have realized it later that justhost dosn't support mysqlnd and PHP 5.3 so I have to change my db class method which are using mysqli->fetch_all() .

Does any one know a way to save this effort? Maybe another way arround by using a plugin or middle layer or some thing I can switch or test if mysqlnd is supported at the server or not ?

I would suggest going forward with a database layer like PDO or Zend_Db. Just choose one that you prefer.

Now as far as fixing all your existing code:

  1. Most IDE's have some sort of find replace function that can work over multiple files.
  2. If you are using OSX/Linux you may want to look at some command line tools like sed to replace the code in your existing files. Might be a bit of a learning curve on that though.