小编mar*_*t15的帖子

如何对多维数组中的所有列值求和?

如何通过关联键添加所有列值?请注意,__CODE__密钥是动态的.

输入数组:

Array
(
    [0] => Array
        (
            [gozhi] => 2
            [uzorong] => 1
            [ngangla] => 4
            [langthel] => 5
        )

    [1] => Array
        (
            [gozhi] => 5
            [uzorong] => 0
            [ngangla] => 3
            [langthel] => 2
        )

    [2] => Array
        (
            [gozhi] => 3
            [uzorong] => 0
            [ngangla] => 1
            [langthel] => 3
        )
)
Run Code Online (Sandbox Code Playgroud)

期望的结果:

Array
(
    [gozhi] => 10
    [uzorong] => 1
    [ngangla] => 8
    [langthel] => 10
)
Run Code Online (Sandbox Code Playgroud)

php arrays sum multidimensional-array

107
推荐指数
7
解决办法
20万
查看次数

PHP/regex:如何获取HTML标记的字符串值?

我需要有关正则表达式的帮助,或者preg_match因为我不是那么有经验但关于那些,所以这里是我的问题.

我需要获得值"得到我",但我认为我的函数有错误.html标签的数量是动态的.它可以包含许多嵌套的html标记,如粗体标记.此外,"get me"值是动态的.

<?php
function getTextBetweenTags($string, $tagname) {
    $pattern = "/<$tagname>(.*?)<\/$tagname>/";
    preg_match($pattern, $string, $matches);
    return $matches[1];
}

$str = '<textformat leading="2"><p align="left"><font size="10">get me</font></p></textformat>';
$txt = getTextBetweenTags($str, "font");
echo $txt;
?>
Run Code Online (Sandbox Code Playgroud)

html php regex

35
推荐指数
3
解决办法
10万
查看次数

如何将<font size ="10">转换为px?

我需要转换<font size="10">为px.

仅示例(不正确):<font size="10">相当于12px.

是否有任何公式或表转换转换<font size="10">为px?

html fonts font-size

29
推荐指数
3
解决办法
11万
查看次数

CSS:如何使左浮动div动态调整高度?

如何使用静态内容使我的浮动左div自动调整其高度与动态内容的右浮动div的高度相同?

所以我想要完成的是左右两边的div都有相同的高度(左边的div自动调整到右边的div的高度)

下面是示例代码.

提前致谢 :)

干杯,马克

<html>
<head>
    <style type="text/css">
        body {
            font-family:verdana;
            font-size:12px;
        }
        .parent {
            border:1px solid red;
            width:530px;
            /*min-height:100%;*/
            padding:5px;
        }
        .left {
            border:1px solid blue;
            width:200px;
            float:left;
            position:relative;
            padding:3px;
        }
        .right {
            border:1px solid green;
            width:300px;
            float:right;
            position: relative;
            padding:3px;
        }
        .clr { clear:both; }
        .footer {
            border:1px solid orange;
            position: relative;
            padding:3px;
            margin-top:5px;
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="left">float left div here only static content</div>
        <div class="right">
            float right div dynamic content here<br …
Run Code Online (Sandbox Code Playgroud)

html css

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

MAMP:如何安装Memcached?

我尝试使用本教程在MAMP中安装memcached - Snow Leopard 10.6.2:

设置启用Memcached的MAMP沙箱环境

我完成了第一步到最后一步没有错误:奖金部分:使用MAMP启动和停止Memcache

之后,我在仪表板中重新启动了我的MAMP小部件,并通过phpinfo进行了检查,但memcached扩展不在那里.

你们成功地在你的MAMP中安装了memcached吗?或者你知道如何让它工作吗?

提前致谢 :)

memcached mamp

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

如何在mac osx雪豹中安装php5 curl?

如何在mac osx雪豹中安装php5 curl模块或任何其他php5模块?

在Ubuntu 9.04我使用:

sudo apt-get install php5-curl
Run Code Online (Sandbox Code Playgroud)

我已经尝试过谷歌搜索,但找不到一些解决方案.

php macos osx-snow-leopard

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

如何删除Google柱形图中的水平网格线?

如何删除谷歌列图表中的水平网格线?我尝试了一些解决方案,但仍然无法将其删除.谢谢.

function drawVisualization() {
    // Create and populate the data table.
    var data = google.visualization.arrayToDataTable([
        ['Year', 'Austria', 'Belgium', 'Czech Republic', 'Finland', 'France', 'Germany'],
        ['2003',  1336060,   3817614,       974066,       1104797,   6651824,  15727003],
        ['2004',  1538156,   3968305,       928875,       1151983,   5940129,  17356071],
        ['2005',  1576579,   4063225,       1063414,      1156441,   5714009,  16716049],
        ['2006',  1600652,   4604684,       940478,       1167979,   6190532,  18542843],
        ['2007',  1968113,   4013653,       1037079,      1207029,   6420270,  19564053],
        ['2008',  1901067,   6792087,       1037327,      1284795,   6240921,  19830493]
    ]);

    // Create and draw the visualization.
    new google.visualization.ColumnChart(document.getElementById('visualization')).
    draw(
        data,
        {
            title:"Yearly Coffee Consumption …
Run Code Online (Sandbox Code Playgroud)

google-visualization

9
推荐指数
1
解决办法
9283
查看次数

/**/comment块的Netbeans宏命令

我正在使用Netbeans 6.8并尝试使用/**/style而不是通常的双斜杠创建自定义PHP注释代码块宏.

到目前为止,谷歌搜索并在PHPUGPH中询问,我得到了这个宏代码(tools-> options-> editor-> macros):

copy-to-clipboard delete-previous "/*" paste-from-clipboard "*/" 
Run Code Online (Sandbox Code Playgroud)

您必须首先突出显示代码并按快捷键组合以创建注释块.

我现在的问题是我不知道取消注释PHP块的宏代码.我找到了一些代码,但我无法使其工作.

php macros netbeans

8
推荐指数
1
解决办法
8312
查看次数

jQuery:如何在onblur之前先点击onclick?

如果我目前专注于jQuery中的文本框,如何在onblur事件之前首先触发onclick事件?

预期输出:在texbox中的模糊事件之前首先触发按钮单击事件.提醒"mybtn onclick alert"

演示: http ://jsfiddle.net/Zk8Fg/

码:

<input type="text" name="fname" id="fname" value="" /><br />
<input type="button" name="mybtn" id="mybtn" value="Click Me" />

<script language="javascript">
$(document).ready(function() {
    myFunc();
});

function myFunc() {
    $('#fname').focus().blur(function() {
        alert('fname onblur alert'); 
    });

    $('#mybtn').click(function() {
        alert('mybtn onclick alert'); 
    });
}
</script>
Run Code Online (Sandbox Code Playgroud)

谢谢 :)

jquery javascript-events

7
推荐指数
2
解决办法
8786
查看次数

jQuery AJAX:如何将大型HTML标记作为参数传递?

如何使用jQuery AJAX将大型HTML标记数据传递给我的PHP?当我收到结果时,这是错误的.

jQuery AJAX代码:

$('#saveButton').click(function() {
        // do AJAX and store tree structure to a PHP array 
        //(to be saved later in database)
        var treeInnerHTML = $("#demo_1").html();
        alert(treeInnerHTML);
        var ajax_url = 'ajax_process.php';
        var params = 'tree_contents=' + treeInnerHTML;
        $.ajax({
            type: 'POST',
            url: ajax_url,
            data: params,
            success: function(data) {
                $("#show_tree").html(data);

            },
            error: function(req, status, error) { }
        });
});
Run Code Online (Sandbox Code Playgroud)

treeInnerHTML实际值:

<ul class="ltr">
   <li id="phtml_1" class="open">
       <a href="#"><ins>&nbsp;</ins>Root node 1</a>
       <ul>
           <li class="leaf" id="phtml_2">
             <a href="#"><ins>&nbsp;</ins>Child node 1</a>
           </li>
           <li …
Run Code Online (Sandbox Code Playgroud)

ajax jquery

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