小编Mar*_*pel的帖子

让用户在注册前尝试您的网络应用:会话或临时数据库?

我已经看到了一些实例,Web应用程序在没有您必须注册的情况下试用它们(尽管为了节省您的需要).

示例:尝试访问http://minutedock.com/

我想知道为我自己的网络应用程序做这个,基本的问题是是将它们的信息存储到会话还是临时用户表?

临时用户表将允许日志记录,并且可能对服务器的影响较小,对吗?

这里有最好的做法吗?

php mysql session

6
推荐指数
1
解决办法
95
查看次数

phpunit抛出未捕获的异常'PHPUnit_Framework_Exception

我有一个Zend Framework项目,并希望使用单元测试来测试它.

在tests文件夹中,我有phpunit.xml以下内容:

<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="Application Test Suite">
    <directory>./</directory>
</testsuite>

<filter>
    <whitelist>
        <directory suffix=".php">../application/</directory>
        <exclude>
            <directory suffix=".phtml">../application/</directory>
            <file>../application/Bootstrap.php</file>
            <file>../application/controllers/ErrorController.php</file>
        </exclude>
    </whitelist>
</filter>

<logging>
    <log type="coverage-html" target="./log/reprot" charset="UTP-8"
    yui="true" highlight = "true" lowUpoerBound="50" highLowerBound="80"/>
    <log type="textdox" target="./log/testdox.html" />
</logging>
Run Code Online (Sandbox Code Playgroud)

bootstrap.php在/ tests/application文件夹中有如下内容:

    <?php
error_reporting(E_ALL | E_STRICT);

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));

// Ensure library/ is on include_path …
Run Code Online (Sandbox Code Playgroud)

php phpunit zend-framework

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

换行符不会显示在IE中的textarea中

使用jQuery的.load()方法我将文本加载到textarea中.适用于Chrome和FF.与往常一样,IE必须是不同的,不会显示换行符.

我试过white-space:pre-wrap没有运气.

有任何想法吗?

我的代码:

$('#textarea').load('data.php');
Run Code Online (Sandbox Code Playgroud)

data.php简单查询MySQL数据库,并打印出结果.

html javascript ajax jquery internet-explorer

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

PDO + MySQL总是返回字符串,但是MsSQL呢?

使用MySQL时,PDO始终将字段值作为字符串返回.使用MSSQL等其他数据库时,PDO是否一致?

如果没有,是否有一个标志迫使PDO始终返回字符串(为了保持一致性)?或者更好的是还是为所有值返回原生类型?

据我所知,Drupal可以使用PDO使用不同的数据库.它执行必要的转换以使SQL语句与不同的语法兼容.但它如何处理查询结果中的数据类型?

php mysql sql-server pdo

6
推荐指数
1
解决办法
2257
查看次数

停止在临时变量中保存'this'

我不得不持有this一个临时变量,以便在其他函数中访问它.例如,在下面的两个方法中,我持有this一个that变量:

startTimer: function () {
    var that = this;

    if ($('#defaultCountdown:hidden'))
        $('#defaultCountdown').show('slow');
    shortly = new Date();
    shortly.setSeconds(shortly.getSeconds() + 5);
    $('#defaultCountdown').countdown('change', { until: shortly,
        layout: '<ul id="errorList"><li>Next update in <b>{snn}</b> {desc}</li></ul>',
        description: 'seconds',
        onExpiry: function () {
            that.performUpdate();
        }
    });
},
performUpdate: function () {
    var that = this;

    this.message.fetch({
        success: function () {
            $('#calleesStatuses').html('');
            that.callees.refresh(that.message.get("Callees"));
            $('#defaultCountdown').hide('slow');
            that.startTimer();
        },
        error: function (request, settings) {
            that.killCountDown();
            showErrorMessage(request.responseText)
        }
    });
},
Run Code Online (Sandbox Code Playgroud)

反正在这周围还是我可以使用apply

javascript

6
推荐指数
1
解决办法
138
查看次数

是否可以使Firebug控制台自动化?

我想在firebug JavaScript控制台中自动执行操作.即.是否可以在firefox中从url加载页面然后在加载页面后在控制台中运行js代码?我用google搜索解决方案,找到一个:使用FBTest运行Running_Automated_Test_Suite

有没有其他方法可以做到这一点?哪一个更容易?在linux/mac中使用windows cmd-line/bash脚本的一些方法?硒?

javascript firefox firebug automation

5
推荐指数
1
解决办法
544
查看次数

可下载的HTML测试语料库

我正在开发一个用于Firefox的浏览器插件,我希望能够进行一些自动化测试,以确保它正确处理各种不同的HTML/JavaScript功能.有没有人知道可以用于此类测试的HTML和/或JavaScript页面的良好可下载语料库?

html javascript testing

5
推荐指数
1
解决办法
714
查看次数

=?ISO-8859-1邮件主题

我通过PHP及其方法imap_open获取了我在GMail帐户中的未读邮件

当我通过方法imap_fetch_overview得到主题时,我得到一些这样的主题:

=?ISO-8859-1?Q?Informaci=F3n_Apartamento_a_la_Venta?= =?ISO-8859-1?Q?_en_Benasque(Demandas:_0442_______)?=
Run Code Online (Sandbox Code Playgroud)

这是不可读的,我认为是因为它的字符编码.

我该怎么做才能使它具有可读性?

php encoding decoding

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

如何在键入时格式化contenteditable div?

我正在尝试编写一个函数,允许一个contenteditable div在用户输入div时进行一些自动格式化.到目前为止,我只能让它在IE中运行.有人可以帮帮我吗?

function formatOnKeyUp(){
    if (window.getSelection) {
        // ???????
    } else if (document.selection) {
        cursorPos=document.selection.createRange().duplicate();
        clickx = cursorPos.getBoundingClientRect().left; 
        clicky = cursorPos.getBoundingClientRect().top;
    }

    text = document.getElementById('div1').innerHTML;
    text = text.replace(/this/gm, "<i>this</i>");
    // .... some other formating here...
    document.getElementById('div1').innerHTML = text;

    if (window.getSelection) {
        // ????????
    } else if (document.selection) {
        cursorPos = document.body.createTextRange();
        cursorPos.moveToPoint(clickx, clicky);
        cursorPos.select();
    }
}
Run Code Online (Sandbox Code Playgroud)

html javascript html5 contenteditable

5
推荐指数
1
解决办法
3401
查看次数

为什么 WhatsApp 链接共享中不显示图像?

我正在尝试使用开放图谱数据丰富网站,让页面作者决定哪些图像和文本显示在社交媒体的预览中。但是,我无法让 WhatsApp 在共享卡中显示小图像。

\n\n

我当前的标记如下所示:

\n\n
<meta property="og:url" content="https://dev.firapeel.nl/activiteiten/%CE%A3%CF%89%CE%BA%CF%81%CE%AC%CF%84%CE%B7%CF%82">\n<meta property="og:title" content="\xce\xa3\xcf\x89\xce\xba\xcf\x81\xce\xac\xcf\x84\xce\xb7\xcf\x82">\n<meta name="description" content="Excerpt of Greek text, something by Plato">\n<meta property="og:description" content="Excerpt of Greek text, something by Plato">\n<meta property="og:image" content="https://dev.firapeel.nl/img/opengraphtest/the-alps-4440879_1920.jpg?type=open_graph">\n<meta property="og:image:width" content="600">\n<meta property="og:image:height" content="315">\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我仔细阅读这个答案时,我认为我符合所有提到的要求,并且图像小于300KB且大于300x200。出于测试目的,是包含此数据的页面(页面不会永远在线,但至少只要没有可接受的答案)。

\n\n

让我惊讶的是,这个页面确实在 WhatsApp 上生成了预览图像,所以我查看了它的标记:

\n\n
<meta property="og:type" content="website" />\n<meta property="og:site_name" content="The Criterion Collection" />\n<meta property="og:title" content="Jack Reynor\xe2\x80\x99s Top 10" />\n<meta property="og:url" content="https://www.criterion.com/current/top-10-lists/365-jack-reynor-s-top-10" />\n<meta property="og:description" content="A voracious cinephile with wide-ranging taste, the star of Midsommar shares a list of favorite …
Run Code Online (Sandbox Code Playgroud)

html meta-tags facebook-opengraph whatsapp

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