草庐IT

set_index

全部标签

php - 如何让 index.php 控制 PHP 中的任何内容

首先,我不知道怎么称呼这个东西:)我想知道如何实现我的目标的关键、结构和示例。例如,我不想创建单独的文件,如register.php、login.php、about.phpfaq.php。在这里,我希望register、loginabout、faq等将由index.php处理,例如index.php?p=register如何创建类似这样的页面以及这种结构在PHP编程中调用的内容。让我知道。 最佳答案 在index.php?p=register中,?之后的部分称为“查询字符串”。PHP会默认为您解析它并提供超全局的$_GET。自己试试

php - 使用 mysql_set_charset ('utf8' ) 函数后用 UTF-8 替换字符

我将所有mysql表转换为utf-8_unicode并开始使用mysql_set_charset('utf8');函数。但在此之后,一些字符如Ş、Ö开始看起来像Ö、Åž如何将mysql中的这种字母替换为UTF-8格式?很快,我能找到所有这些字符的列表来替换吗?编辑:他实际上在这篇文章中解释了这个问题,但我实际上无法正确理解它,哈哈http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html 最佳答案 你不需要那样做。只需在数据库连

php - Notice : Undefined Index. 如何定义索引?

我收到了回复:Notice:UndefinedindexyyinPage1.phponline11Notice:UndefinedindexmminPage1.phponline12Notice:UndefinedindexddinPage1.phponline13如何定义这些yy、mm、dd?2001//...Another100years12//...another10months12//...another29days 最佳答案 尝试将这些post变量包装在isset中功能:$_SESSION['yy']=isset($_PO

php - WordPress 主题 : Standalone theme need index. php 文件错误

我在编码时突然遇到错误-wordpress->theme:我不明白为什么会这样,因为我有一个index.php页面。也有css样式表。style.css也有如下注释样式.cssThemeName:samirThemeAuthor:samirAuthorURI:www.wordpress.comVersion:1.0Description:ThisisacoolthemeTemplate:Test1这是文件夹结构wordpress新手。很困惑为什么主题被破坏并且没有出现在wordpress中。有什么想法吗? 最佳答案 解决方案解决办法

php - index.php/index.html 文件中模糊的 JavaScript 代码

也许这里有人可以提供帮助或解释发生了什么。今天刚刚注意到,在我的一个客户站点上,所有index.php/index.html都被替换了,并且添加了一些晦涩的javascript代码。代码如下:varnhZE2uSD="Ow8xN18Ow8xN31";varusW1446O0="Ow8xN3cOw8xN73Ow8xN63Ow8xN72";varusW1446O1="Ow8xN69Ow8xN70Ow8xN74Ow8xN20";varusW1446O2="Ow8xN74Ow8xN79Ow8xN70Ow8xN65";varusW1446O3="Ow8xN3dOw8xN22Ow8xN74Ow8x

PHP session.cookie_secure : Disables sessions when set to true

当我设置以下配置时:ini_set("session.cookie_secure",1);我的整个应用程序的session已禁用,我无法再写入或读取session变量。$sessionName="us";session_name($sessionName);ini_set('session.cookie_httponly',1);ini_set('session.entropy_file','/dev/urandom');ini_set('session.hash_function','whirlpool');ini_set('session.use_only_cookies',1);

php - 如何避免 undefined index

如何轻松避免在PHP中收到此错误/通知?Notice:Undefinedindex:testin/var/www/page.phponline21代码:$table='test';$preset=array();method($preset[$table]);数组$preset存在但不具有指定的索引 最佳答案 使用array_key_exists检查它是否存在:$table='test';$preset=array();if(array_key_exists($table,$preset)){method($preset[$tabl

php - 代码点火器 2.1.3 : sess_destroy() causes Undefined index: session_id etc notice when 'sess_use_database' == TRUE

我一直在使用数据库测试codeigniter的session功能,每当我注销(使用sess_destroy())时,我都会收到以下通知:APHPErrorwasencounteredSeverity:NoticeMessage:Undefinedindex:session_idFilename:libraries/Session.phpLineNumber:272APHPErrorwasencounteredSeverity:NoticeMessage:Undefinedindex:ip_addressFilename:libraries/Session.phpLineNumber:2

php - ini_set() 总是返回 false

在我当前的项目中,我有一个security.php,其中包含一些函数和一些ini_set()语句。ini_set('session.use_trans_sid',0);ini_set('session.use_only_cookies',1);ini_set('session.cookie_secure',1);ini_set('session.hash_function','whirlpool');ini_set('session.cookie_httponly',1);ini_set('session.hash_bits_per_character','5');所以这是我的问题。如

PHP 5.6 : ArrayAccess: Function isset calls offsetGet and causes undefined index notice

我编写了实现ArrayAccess接口(interface)的简单PHP类:classMyArrayimplementsArrayAccess{public$value;publicfunction__construct($value=null){$this->value=$value;}publicfunction&offsetGet($offset){var_dump(__METHOD__);if(!isset($this->value[$offset])){thrownewException('Undefinedindex:'.$offset);}return$this->val