小编pro*_*yse的帖子

PHP 从字符串中删除特殊字符并留下一些

我需要从字符串中删除所有特殊字符,除了 - ( )

到目前为止我有这个代码

$q = preg_replace('/[^A-Za-z0-9\-]/', '', $q); //removes ALL characters
Run Code Online (Sandbox Code Playgroud)

如何排除- ( )

php regex preg-replace

3
推荐指数
1
解决办法
2万
查看次数

用于jQuery脚本的Drupal 7 TypeError:$不是函数

我有一些JS代码,但Drupal 7无法识别它.我收到以下错误:

TypeError: $ is not a function
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮助我使这个脚本工作吗?我正在使用jQuery v1.4.4.

<script type="text/javascript">
this.screenshotPreview = function(){    
/* CONFIG */

    xOffset = 10;
    yOffset = 30;

    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result

/* END CONFIG */
$("a.screenshot").hover(function(e){
    this.t = this.title;
    // this.title = "";    
    var c = (this.t != "") ? "<br/>" + this.t : "";
    $("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");                                
    $("#screenshot") …
Run Code Online (Sandbox Code Playgroud)

javascript jquery drupal drupal-7

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

drupal ×1

drupal-7 ×1

javascript ×1

jquery ×1

php ×1

preg-replace ×1

regex ×1