小编Clé*_*aud的帖子

如何在浏览器中正确显示数组

我只是一个小问题.我在网上搜索但我没有找到任何东西.

我经常使用print_rvar_dump经常使用 我正在寻找一种方法来正确地显示具有这些方法的数组,具有正确的格式,对齐等...但不是所有在一行上使得它难以理解.

我怎样才能做到这一点?

php arrays

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

PHP DOMDocument,只检索div的内容,没有div标签

我正在使用DOMDocument在HTML页面上检索一个特殊的div.

我只想在没有div标签的情况下检索这个div的内容.

例如 :

$dom = new DOMDocument;
$dom->loadHTML($webtext['content']);
$main = $dom->getElementById('inter');
$dom->saveHTML()
Run Code Online (Sandbox Code Playgroud)

在这里,我有结果:

<div id="inter">
//SOME THINGS IN MY DIV
</div>
Run Code Online (Sandbox Code Playgroud)

我只想拥有:

//SOME THINGS IN MY DIV
Run Code Online (Sandbox Code Playgroud)

想法?谢谢 !

php domdocument

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

HTML5画布,调整背景图像的大小

我有一个动态创建的画布,因此宽度和高度总是不同的.

我有一个背景图片我想放在这个画布上,所以我只是添加CSS:

canvas { background:url(/URL/background-canvas.jpg) }
Run Code Online (Sandbox Code Playgroud)

但是,我怎么能自动将图像调整到我画布的大小?谢谢 !

html5 canvas image

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

jQuery在更改事件中获得div prev

我有一个像以下的HTML代码:

<div class="callcenter" style="" data-id="2">
  <select class="entityChange">
    <option value=""></option>
    <option value="8">callcenter1</option>
  </select>
</div>
Run Code Online (Sandbox Code Playgroud)

还有一个事件:

        $(document).on('change', '.entityChange', function() {
            var ficheId = $(this).prev().attr("data-id");
            var type = $(this).prev().attr("data-type");
            var newUserId = $(this).val();

            console.log($(this).prev());
        });
Run Code Online (Sandbox Code Playgroud)

我试图在这个事件中检索我的第一个div的归属但我不能用prev().

有任何想法吗 ?

html javascript jquery

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

jQuery,添加draggable以追加对象

我是successajax请求的处理程序,如:

    $.ajax({
        type: "POST",
        url: "{{ path('getevents') }}",
        data: {start: start, end : end},
        success: function (data) {

            for ( var i = 0; i < data['rdv'].length; i++ ) {
                var divRdv = '<div>My div</div>';
                $('myElement').append(divRdv);

                $(divRdv).draggable(); // THIS DOESN'T WORK
            }
        },
        error: function (xhr, status, error) {
          console.log(xhr.responseText);
      }
  });
Run Code Online (Sandbox Code Playgroud)

所以,在一个循环中,我需要创建一个div divRdv,将这个div附加到myElement,之后,我希望这个div可拖动.

我能怎么做 ?

我试图逐个添加draggable到每个div,有一种方法可以一次添加draggable到多个元素?

javascript jquery jquery-ui

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

SonarQube分析失败

我正在使用SonarQube 6.1,我正在使用Symfony 2.8项目.

当我使用声纳扫描仪运行分析时,我得到一个分析成功,但结果在我的日志中失败:

Error Details

org.sonar.server.computation.task.projectanalysis.component.VisitException: Visit of Component {key=ThisIsMyFuckingProjectKeyFor:XXXXXX:src/AdminBundle/AdminBundle.php,type=FILE} failed
    at org.sonar.server.computation.task.projectanalysis.component.VisitException.rethrowOrWrap(VisitException.java:44)
    at org.sonar.server.computation.task.projectanalysis.component.VisitorsCrawler.visit(VisitorsCrawler.java:74)
    at org.sonar.server.computation.task.projectanalysis.component.VisitorsCrawler.visitChildren(VisitorsCrawler.java:110)
    at org.sonar.server.computation.task.projectanalysis.component.VisitorsCrawler.visitImpl(VisitorsCrawler.java:97)
    at org.sonar.server.computation.task.projectanalysis.component.VisitorsCrawler.visit(VisitorsCrawler.java:72)
    at org.sonar.server.computation.task.projectanalysis.component.VisitorsCrawler.visitChildren(VisitorsCrawler.java:110)
    at org.sonar.server.computation.task.projectanalysis.component.VisitorsCrawler.visitImpl(VisitorsCrawler.java:97)
    at org.sonar.server.computation.task.projectanalysis.component.VisitorsCrawler.visit(VisitorsCrawler.java:72)
    at org.sonar.server.computation.task.projectanalysis.step.ExecuteVisitorsStep.execute(ExecuteVisitorsStep.java:51)
    at org.sonar.server.computation.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64)
    at org.sonar.server.computation.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52)
    at org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:84)
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:57)
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:35)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: The manDays for language php is not a valid long number
    at org.sonar.server.computation.task.projectanalysis.qualitymodel.RatingSettings.getDevCost(RatingSettings.java:87)
    at org.sonar.server.computation.task.projectanalysis.qualitymodel.QualityModelMeasuresVisitor.computeDevelopmentCost(QualityModelMeasuresVisitor.java:126)
    at org.sonar.server.computation.task.projectanalysis.qualitymodel.QualityModelMeasuresVisitor.visitFile(QualityModelMeasuresVisitor.java:119)
    at org.sonar.server.computation.task.projectanalysis.component.PathAwareVisitorWrapper.visitFile(PathAwareVisitorWrapper.java:66) …
Run Code Online (Sandbox Code Playgroud)

php symfony sonarqube

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

特定 div 内联块后的 CSS 中断

我有这样的 div:

<div id="1" style="display:inline-block">MY DIV 1</div>
<div id="2" style="display:inline-block">MY DIV 2</div>
<div id="3" style="display:inline-block">MY DIV 3</div>
<div id="4" style="display:inline-block">MY DIV 4</div>
<div id="5" style="display:inline-block">MY DIV 5</div>
<div id="6" style="display:inline-block">MY DIV 6</div>
Run Code Online (Sandbox Code Playgroud)

所以有了这个,我有 6 个 div,水平对齐在同一条线上。

我想在第二个 div 之后换行,在第四个 div 之后,我想要:

My DIV 1 My DIV 2
My DIV 3 My DIV 4
My DIV 5 My DIV 6
Run Code Online (Sandbox Code Playgroud)

有任何想法吗 ?

html javascript css jquery

0
推荐指数
1
解决办法
772
查看次数

Laravel响应json无用数组

我正在使用Laravel开发一个API,我的json响应有问题,例如我有一个函数:

    $company = Company::select('name')
        ->inRandomOrder()
        ->limit(1)
        ->get();

    return response()->json([
        'company' => $company,
    ]);
Run Code Online (Sandbox Code Playgroud)

有了这个,我在调用我的函数时得到:

{
    "company": [
        {
            "name": "Company Number 1"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

为什么我公司之后有阵列?"company": [有没有办法在$company没有对象之前直接返回(在我的示例中命名为company?)

谢谢 !

php json laravel laravel-5.3

0
推荐指数
1
解决办法
771
查看次数

无法使用Perl在@INC中找到DBI.pm

我是Perl的新手,我安装了DBI模块但是当我尝试运行我的脚本时出现这个错误:

Can't locate DBI.pm in @INC (you may need to install the DBI module) (@INC contains:
    /usr/lib/x86_64-linux-gnu/perl5/5.20/DBI.pm
    /home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux
    /home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1
    /home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux
    /home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1
    .
    ) at call_request.pl line 12.
Run Code Online (Sandbox Code Playgroud)

[添加了换行符以提高可读性]

我知道还有另一个主题是同一主题,但没有答案.我不知道我能做什么..?

我在linux上(ubutunu)

感谢帮助 !

编辑:

输出:

perl est /home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/bin/perl

cpan est /home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/bin/cpan

#!/home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/bin/perl
    eval 'exec /home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/bin/perl -S $0 ${1+"$@"}'
    if $running_under_some_shell;

grep arg
    make_arg           []
    make_install_arg   []
    makepl_arg         [INSTALLDIRS=site]
    mbuild_arg         []
    mbuild_install_arg []
    mbuildpl_arg       [--installdirs site]

PERLBREW_PERL: perl-5.20.1
PERLBREW_VERSION: 0.73
PERLBREW_ROOT: /home/heisenberg/perl5/perlbrew
PERLBREW_MANPATH: /home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/man
PERLBREW_HOME: /home/heisenberg/.perlbrew
PERLBREW_BASHRC_VERSION: 0.73
PERLBREW_PATH: /home/heisenberg/perl5/perlbrew/bin:/home/heisenberg/perl5/perlbrew/perls/perl-5.20.1/bin
PERL5LIB: /usr/lib/x86_64-linux-gnu/perl5/5.20/DBI.pm
Run Code Online (Sandbox Code Playgroud)

linux perl

-1
推荐指数
1
解决办法
5776
查看次数