分类: 编程语言

wordpress 评论必须包含中文

在后台主题->主题文件->functions.php在文件最底部添加如下代码 function scp_comment_post( $incoming_comment ) { $pattern = \’/[一-龥]/u\’; // 禁止全英文评论 if(!preg_match($pattern, $incoming_comment[\’comment_content\’])) { wp_die( "您的评论中必须包含汉字!" ); } return( $incoming_comment ); } add_filter(\’preprocess_comment\’…

error C2039 min 不是 std 的成员

报错 1>supportedfeaturespacket.cpp 1>..\communication\packet\supportedfeaturespacket.cpp(32): error C2039: “min”: 不是“std”的成员 1>D:\Software\Microsoft\Visual Studio\2022\Professional\VC\Tools\MSVC\14.16.27023\include\set(18): note: 参见“std”的声明 1>..\communication\packet\supportedfeaturespacket…

C++ 记录程序运行时间间隔

方式一 #include<iostream> #include<ctime> using namespace std; int main() { clock_t startTime,endTime; // 计时开始 startTime = clock(); for (int i = 0; i < 2147483640; i++) { i++; } // 计时结束 endTime = clock(); cout << "运行时间: " <<(double)(endTime – startTime) / CLOCKS_PER…

VC++ 获取电脑当前的打印机

void EnumeratePrinters() { PRINTER_INFO_2* pPrinterInfo = nullptr; DWORD dwBytesNeeded = 0; DWORD dwNumPrinters = 0; // 获取所需缓冲区大小 EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, nullptr, 2, nullptr, 0, &dwBytesNeeded, &dwNumPrinters); if (dwBytesNeeded > 0) { pPrinterInfo = re…

C++ 单例模式

定义 class CDefaultSetting { protected: CDefaultSetting() {} ~CDefaultSetting() {} public: static CDefaultSetting& GetInstance() { static CDefaultSetting instance; return instance; } public: int m_nTest = 0; }; 使用 CDefaultSetting::GetInstance().m_nTest = 1;

Viusal Studio 报错 error C2760 语法错误 意外的令牌标识符

报错信息: 1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\objbase.h(239): error C2760: 语法错误: 意外的令牌“标识符”,预期的令牌为“类型说明符” 1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\gdiplusheaders.h(891): error C4596: “EmfToWmfBits”: 成员声明中的非法限定名 1>c:\program files (x86)\microsoft sd…