check if php file exists on server

后端 未结 2 1343
感情败类
感情败类 2021-01-25 02:10

I\'m looking for a way to see if a file exists on the local server. I would usually use if function exists but in this case it\'s not an option. My question is how can I get num

2条回答
  •  悲&欢浪女
    2021-01-25 02:51

    You can't use file_exists -- You'll need to use get_headers

    $headers = get_headers('http://vac3:8888/wp-content/themes/vac3/acf/page_meta/functions.php', 1);
    $file_found = stristr($headers[0], '200');
    

提交回复
热议问题