duanke0178 2009-06-13 06:37
浏览 77
已采纳

如何让DOCUMENT_ROOT在localhost和web主机上工作?

I have a WordPress plugin that I would like to work on localhost as well as in deployment without modification, but I can't seem to set the location for a directory using one statement.

I would like to do this:

$feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/wp-content/cache');

While that works on the web host. On localhost it produces this error:

C:/xampp/htdocs/wp-content/cache/a547b8792c3144c98549be23ef1465e7.spc is not writeable

On localhost, I need to set it to this to get it work:

$feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/mysite/wp-content/cache');

Surely there must be something that works both on localhost and on a web host!

Thanks.

  • 写回答

2条回答 默认 最新

  • doushai7225 2009-06-13 06:51
    关注

    Check this out Determining Plugin and Content Directories WP already has this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法