我已经阅读了很多关于它的问题和答案,但我仍然无法解决我的问题......
我正在尝试创建一个函数,删除前一天创建的"xml"或"xsl"扩展名的所有文件.但我在每个文件上收到此警告:
警告:filemtime()[function.filemtime]:第44行/home/u188867248/public_html/ampc/library.php中post_1003463425.xml的stat失败
此目录的所有文件具有相同的结构名称"post_ + randomNum + .xml"(例如:post_1003463425.xml或post_1456463425.xsl).所以我认为这不是编码问题(就像我在其他问题中看到的那样).
我的功能代码是这样的:
function deleteOldFiles(){
if ($handle = opendir('./xml')) {
while (false !== ($file = readdir($handle))) {
if(preg_match("/^.*\.(xml|xsl)$/i", $file)){
$filelastmodified = filemtime($file);
if ( (time()-$filelastmodified ) > 24*3600){
unlink($file);
}
}
}
closedir($handle);
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助 :)
我有一个用打字稿编译的共享 React 组件库。目前我正在使用 CommonJs 模块编译库,但我也希望 ES2015 模块可用,以便在消费者项目中使用Webpack 树摇动。
库文件夹结构如下所示:
该index.ts文件是我拥有公共 API 的地方。一个例子是:
// Components
export { default as AlertBox } from './components/AlertBox/AlertBox';
export { default as Button } from './components/Button/Button';
Run Code Online (Sandbox Code Playgroud)
我有这个打字稿配置(tsconfig.json):
{
"compilerOptions": {
"baseUrl": ".",
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"noImplicitAny": false,
"sourceMap": true,
"outDir": "./dist",
"jsx": "react",
"allowSyntheticDefaultImports": true,
"declaration": true,
"paths": {
"*": ["public/*", "src/*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.test.*"]
}
Run Code Online (Sandbox Code Playgroud)
我试图做这样的事情:
tsc && tsc -m es6 --outDir …Run Code Online (Sandbox Code Playgroud) 我知道您可以使用以下方式从 Symfony 分析器或异常文件链接打开文件project/app/config.yml:
framework:
ide: "phpstorm://open?file=%%f&line=%%l"
Run Code Online (Sandbox Code Playgroud)
更多信息:http : //developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application
但是,当我使用 vagrant 时,服务器的文件路径与我的主机不匹配。
我已经使用正确的路径映射在 PHPStorm 中创建了一个 PHP Web 应用程序服务器,但仍然无法正常工作。
有任何想法吗?
谢谢