我想知道是否可以使用给定的加扰字在数据库中搜索.
我mobs在数据库中有一个表,它包含怪物名称的名称
如果给怪物的名字是A Golden Dregon或A Golden Dfigon或A Gelden Dragon我希望它发现A Golden Dragon或与接近它从数据库匹配.通常,最大的一个或两个字母像这样被加扰.
只有SQL查询才有可能吗?或者我应该通过解析给定的怪物名称来构建查询?
我在代码方面使用LUA.
有没有办法在该类之外声明新的静态变量,即使它没有在类中设置?
// Using this class as a static object.
Class someclass {
// There is no definition for static variables.
}
// This can be initialized
Class classA {
public function __construct() {
// Some codes goes here
}
}
/* Declaration */
// Notice that there is no static declaration for $classA in someclass
$class = 'classA'
someclass::$$class = new $class();
Run Code Online (Sandbox Code Playgroud)
如何做呢?
谢谢您的建议。
我需要捕获给定html中的所有链接.
这是示例代码:
<div class="infobar">
... some code goes here ...
<a href="/link/some-text">link 1</a>
<a href="/link/another-text">link 2</a>
<a href="/link/blabla">link 3</a>
<a href="/link/whassup">link 4</a>
... some code goes here ...
</div>
Run Code Online (Sandbox Code Playgroud)
我需要把所有环节中div.infobar,与开始/link/
我试过这个:
preg_match_all('#<div class="infobar">.*?(href="/link/(.*?)") .*?</div>#is', $raw, $x);
Run Code Online (Sandbox Code Playgroud)
但它给了我唯一的第一场比赛.
谢谢你的建议.
我一直想知道是否有可能将另一个对象分配给$ this?
在CodeIgniter中,我从主控制器调用另一个控制器.
应用/控制器/ module.php
Class Module extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function _remap($class, $args = array()) {
// doing some checks that is there a valid file, class and method
// assigning the $method.
// including MY_Module class. I'am extending every module from this class.
// then:
$EG = new $class();
call_user_func_array(array(&$EG, $method), array_slice($this->uri->rsegments, 3));
}
}
Run Code Online (Sandbox Code Playgroud)
在被叫班级:
Class Users extends MY_Module
{
public function __construct() {
parent::__construct();
}
public function index() {
// …Run Code Online (Sandbox Code Playgroud) php ×3
class ×1
codeigniter ×1
controller ×1
declaration ×1
regex ×1
search ×1
sqlite ×1
this-pointer ×1