我收到以下错误:
**Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE)**
Run Code Online (Sandbox Code Playgroud)
注意:它在本地工作,但在生产服务器中面临问题。
private const API_QUERY_PARAM = "api";
private const API_FILE_QUERY_PARAM = "f";
private const API_LOG_STYLE_QUERY_PARAM = "sline";
private const API_CMD_LIST = "list";
private const API_CMD_VIEW = "view";
private const API_CMD_DELETE = "delete";
Run Code Online (Sandbox Code Playgroud) 以下是我的表结构,我想验证price_list_rate
字段,值应该大于零,我尝试了无符号
Version information: 4.5.4.1deb2ubuntu2.1
CREATE TABLE `price_list` (
`price_list_id` int(11) NOT NULL,
`price_list_city_id` int(11) NOT NULL,
`price_list_process_id` int(11) NOT NULL,
`price_list_product_id` int(11) NOT NULL,
`price_list_rate` float UNSIGNED NOT NULL,
`price_list_vendor_rate` int(11) NOT NULL,
`created_by` int(10) UNSIGNED NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_by` int(10) UNSIGNED NOT NULL,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Run Code Online (Sandbox Code Playgroud) 有时,我必须删除服务器上不同文件夹中的多个文件。通过 FTP 逐一查看此内容是一项乏味的工作。我写了一个小脚本来完成这项工作。我可以在 Excel 中导入文件列表,然后将它们复制并粘贴到脚本中。然而,我的方法并不优雅:
$file1 = "some-file.php";
$file12 = "some-file2.php";
...
if (!empty($file1)) {
if ( @unlink ( $_SERVER[DOCUMENT_ROOT]."/".$file1 ) )
{
echo 'The file <strong><span style="color:green;">' . $file1 . '</span></strong> was deleted!<br />';
}
else
{
echo 'Couldn't delete the file <strong><span style="color:red;">' . $file1 . '</span></strong>!<br />';
}}
if (!empty($file2)) { ...
Run Code Online (Sandbox Code Playgroud)
我宁愿用 foreach 和数组来做到这一点,但不知道如何。任何帮助,将不胜感激!