php static 访问,使用PHP访问Static方法的最佳方法
這是我的課堂財產
private $my_paths = array(
'imagemagick' => 'E:\Server\_ImageOptimize\ImageMagick',
'pngcrush' => 'E:\Server\_ImageOptimize\pngCrush\pngcrush.exe',
'jpegtran' => 'E:\Server\_ImageOptimize\jpegtran\jpegtran.exe',
'gifsicle' => 'E:\Server\_ImageOptimize\gifsicle\gifsicle.exe',
'pngquant' => 'E:\Server\_ImageOptimize\pngquant\pngquant.exe',
'pngout' => 'E:\Server\_ImageOptimize\pngout\pngout.exe'
);
同一個類中有一個靜態方法
public static function is_image($file_path)
{
$imagemagick = $this->my_paths['imagemagick']. '\identify';
echo $imagemagick;
}
當然這會給我錯誤
Fatal error: Using $this when not in object context...
然后我嘗試訪問這樣的屬性:: my_paths [‘imagemagick’],但沒有幫助.
我該如何處理?
總結
以上是生活随笔為你收集整理的php static 访问,使用PHP访问Static方法的最佳方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php毕业设计遇到的问题,常见问题_ph
- 下一篇: Linux 命令(30)—— scp 命