问题标签 [unlink]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
729 浏览

php - php中的取消链接功能

是否可以擦除用户定义的函数?

我的 CMS 有一个功能,我想通过添加来更新它。

尝试在主题代码中添加一些代码,这将使我的代码仅在打开此主题时才起作用。

0 投票
1 回答
890 浏览

php - PHP process can't delete a file in `/var/run/`

I have a PHP process that:

  • starts as root
  • writes to and then closes a pid file in /var/run/
  • chown()s said pid file to another user
  • changes to that user via posix_setuid()
  • tries to delete pid file at end of process

Now, even though I am chown()ing the pid file to the current user, it is unable to delete the file claiming "Permission denied" on the unlink() call. That means that even though the effective user owns the file, and the file is NOT open in the current (or any) process, there is still insufficient permission.

On a hunch, I tried moving the pid file location to my home directory, and this works without a problem. Note that the user of the process is not MY personal user, so the effective user has no write permissions on my home directory, just the one specific file.

So, why can't I delete the pid file when it's in /var/run/?

0 投票
9 回答
26399 浏览

php - PHP是否取消链接功能适用于路径?

我想从 PHP 中的文件夹中删除一个文件,但我只有该文件的路径,是否可以提供取消链接的路径?例如

如果这不起作用,那么摆脱这些文件的唯一方法是在 path/to/ 目录中创建一个 .php 文件,并以某种方式将其包含在我的文件中,然后调用那里的方法来删除文件,对吗?

0 投票
2 回答
448 浏览

php - php不断取消链接

我正在试验 php unlink(),我想做的是运行一个 php 脚本,该脚本会在解析后每隔几分钟删除一次创建的文件。我可以使用 cron 或连续运行处理后台解析/删除的文件来做到这一点。我想问的是每隔几分钟就会删除文件,导致我的网络服务器出现问题,或者这样做时是否有任何性能下降或其他一些我想不到的负面影响?

另外,如何创建文件队列以使用 php 处理和处理?这和我上面描述的有什么不同吗?

非常感谢任何帮助,我对此有点迷茫。

0 投票
3 回答
2856 浏览

php - PHP删除具有过期日期的目录中的所有子目录?

有一个目录/home/example/public_html/users/files/。在目录中,有随机名称的子目录,例如2378232828923_1298295497.

如何完全删除创建日期> 1个月的子目录?

有一个很好的脚本可以用来删除文件,但它不适用于 dirs:

0 投票
2 回答
765 浏览

php - 取消链接有时会失败 - 需要改进

我使用我制作的这个自定义的简单脚本,不知何故它失败了,但它总是返回 true。

此类unlink将放置在数组中的文件通过它们然后在成功删除文件时递增计数器,这是我的脚本:

基本上我需要改进如何使其万无一失,以便在取消链接删除文件时完全删除数组中的图像而不返回true,所以我不知道为什么它实际上没有正确删除文件。

有时它工作得很好。

0 投票
3 回答
1173 浏览

php - 警告:取消链接(/web/htdocs/www.vhannibal.net/home/setting/):是 [...] 中的目录

错误是“警告:取消链接(/web/htdocs/www.vhannibal.net/home/setting/):是第 43 行 [...] 中的目录”,第 43 行是

它出什么问题了?

0 投票
1 回答
732 浏览

php - 取消链接功能不适用于 Internet Explorer 中的图像

我在 Internet Explorer 中取消图像链接时遇到问题,但它在 Mozilla 中有效。

我使用了php代码:

0 投票
2 回答
6449 浏览

php - unlink/file_exists 和文件未找到

我的应用程序中有此代码,通常由我的应用程序的多个用户在竞争条件下运行

但是,对于这行代码,我每天仍然有几个错误,比如

unlink(file): 没有这样的文件或目录

服务器运行 Apache 2.2 和 PHP 5.3.3。我知道种族问题,但认为 @ 运算符只是邪恶的。我第一次尝试不使用 clearstatcache() 的任何参数,但同样的错误。我怎样才能以正确的方式做到这一点?

0 投票
4 回答
19175 浏览

php - 文件存在但不会取消链接(PHP)

我正在尝试检查文件是否存在,如果存在则将其删除。出于某种奇怪的原因,检查文件返回 true,但它不会在我的一生中取消链接。这是我的代码。

*note --- 没有 @ 没有错误... *note2 --- 这是在带有 wamp 堆栈的 localhost windows 上,在你说这就是它不起作用之前,我确认另一个使用相同语法的站点适用于他们没有任何特殊权限。

谢谢您的帮助!