小编And*_*res的帖子

Swift_TransportException无法使用host smtp.gmail.com建立连接

我无法想象我的生活为什么它失败了......这是我得到的确切错误:

Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection  
could not be established with host smtp.gmail.com [Connection refused #111]' in 
/home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php:259 
Stack trace: #0 
/home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php(64): 
Swift_Transport_StreamBuffer->_establishSocketConnection() #1 /home/content/38/6896038/html/test/lib/classes/Swift/Transport/AbstractSmtpTransport.php(115): Swift_Transport_StreamBuffer->initialize(Array) #2 /home/content/38/6896038/html/test/lib/classes/Swift/Mailer.php(80): Swift_Transport_AbstractSmtpTransport->start() #3 /home/content/38/6896038/html/test/contact.php(55): Swift_Mailer->send(Object(Swift_Message)) #4 {main} thrown in /home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php on line 259
Run Code Online (Sandbox Code Playgroud)

我使用的代码是我从教程中获得并阅读这里的示例,这里是:

require_once 'lib/swift_required.php';

$transport = Swift_MailTransport::newInstance();

// Create the Transport the call setUsername() and setPassword()
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
  ->setUsername('email@googleappsdomain.com')
  ->setPassword('xxx')
  ;

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

$nombre = $_POST['name']; …
Run Code Online (Sandbox Code Playgroud)

php swiftmailer email-attachments

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

使用PHPExcel将excel文件导入MySQL表

好的,所以我已经能够让php显示excel .xls表中的数据但是这个相同的数据我想能够插入到我的表中.我似乎无法想出那部分,这是我到目前为止所得到的:

    $path = $_GET['file'];
include("../class/sql.php");
require '../class/PHPExcel.php';
require_once '../class/PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load($path);
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
    $worksheetTitle     = $worksheet->getTitle();
    $highestRow         = $worksheet->getHighestRow(); // e.g. 10
    $highestColumn      = $worksheet->getHighestColumn(); // e.g 'F'
    $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
    $nrColumns = ord($highestColumn) - 64;
    echo '<br>Data: <table width="100%" cellpadding="3" cellspacing="0"><tr>';
    for ($row = 1; $row <= $highestRow; ++ $row) {

        echo '<tr>';
        for ($col = 0; $col < $highestColumnIndex; ++ $col) {
            $cell = $worksheet->getCellByColumnAndRow($col, $row);
            $val = $cell->getValue();
            if($row === 1)
            echo …
Run Code Online (Sandbox Code Playgroud)

php mysql import phpexcel

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

从iframe调用父级中的Fancybox

我有2页,我的index.html和social.html.我清理了我的索引,只留下了fancybox的jquery代码需要我想要做的是在social.html中有图像,当点击它时,它会打开fancybox并显示它但在index.html中不在iframe内部.出现的错误是:

Uncaught TypeError: Property 'showImage' of object [object DOMWindow] is not a function
(anonymous function)social.html:103
  onclick 
Run Code Online (Sandbox Code Playgroud)

这是我的index.html:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript" src="js/video.js"></script>
<script type="text/javascript">
        function showImage(image) {
            $.fancybox('<img src="img/' + image + '" alt="" border="0" />');
        };
</script>

</head>

<body>
<iframe src="social.html" scrolling="no" border="0" width="579" height="505" allowtransparency="true"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

在IFrame页面中:

 <img src="img/picture1.jpg" alt="" class="thumbs" onclick="parent.showImage('picture1.jpg');"/>
Run Code Online (Sandbox Code Playgroud)

PS:两个页面都在同一个域...编辑:video.js - >这是来自fancybox我没有这个.

jQuery(document).ready(function() {

    $(".video").click(function() {
        $.fancybox({
            'padding'       : 0,
            'autoScale'     : …
Run Code Online (Sandbox Code Playgroud)

html iframe jquery fancybox

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

jquery验证动态添加输入

我目前正在使用bassistance jquery验证或jqueryvalidation插件(它们重命名),我让它验证一个这样的表单:

if($.fn.validate) {
        $("#frmNewOrder").validate({
            rules: {
                txtAmount: {
                    required: true,
                    digits: true
                },
                ddlAccount: {
                    required: true
                },
                ddlBank: {
                    required: true
                }
            }
        });
    }
Run Code Online (Sandbox Code Playgroud)

现在取决于我需要的数量或不是额外的字段下拉列表,并根据该下拉列表另一个文本输入.所以它就像:

 if($('#txtAmount').val() >= 10000){
     //add ddlReason required
 }

 if($('#ddlReason').val() == 'o'){
     //add txtReason required
 }
Run Code Online (Sandbox Code Playgroud)

我已经尝试像其他字段一样添加css类'required',但如果它们不在规则中,我会接受它然后它不起作用?我试过添加这样的规则:

 $( "#ddlReason" ).rules( "add", {
        required: true});
Run Code Online (Sandbox Code Playgroud)

这也不起作用.有什么建议?

编辑:这是我正在使用的jquery验证的链接.如果我在外面使用规则则会出现此错误:

Uncaught TypeError: Cannot read property 'settings' of undefined 
Run Code Online (Sandbox Code Playgroud)

在第124行:

var settings = $.data(element.form, 'validator').settings;
Run Code Online (Sandbox Code Playgroud)

并使用我在其他地方看到的建议我做了这个导致错误的原因:

var defaultrules = {
    txtAmount: {
        required: true,
        digits: …
Run Code Online (Sandbox Code Playgroud)

jquery dynamic jquery-validate

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

带全宽物品的砌体

我遇到了砌体的问题,如果我需要一个元素为100%宽度而其余元素为50%宽度,则布局不再使我的元素彼此相邻.我想要的是,当没有100%-width元素时,项目会像他们一样并排显示.

这是一个js小提琴:https://jsfiddle.net/ubmf47s4/2/

    <div id="boxes" class="masonry clearfix">
    <div class="box box-fw" style="background: cyan;">
        <div class="inner">
        <p>lkaj dlksaj ldksjf lkdj flksd flkds flkds flksd jfakldsjf lkdsj flkjfd </p>
        </div>
    </div>
    <div class="box" style="background: magenta;">
        <div class="inner">
        <p>lkaj dlksaj ldksjf lkdj flksd flkds flkds flksd jfakldsjf lkdsj flkjfd </p>
        </div>
    </div>
    <div class="box" style="background: yellow;">
        <div class="inner">
        <p>lkaj dlksaj ldksjf lkdj flksd flkds flkds flksd jfakldsjf lkdsj flkjfd </p>
        </div>
    </div>
    <div class="box" style="background: grey;">
        <div class="inner">
        <p>lkaj dlksaj ldksjf lkdj …
Run Code Online (Sandbox Code Playgroud)

javascript css masonry

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

在ul list jquery中找到每个div

我有一个模态弹出窗口,它有不同的div用于不同的消息,现在我想隐藏每个div并显示我需要显示的那个.而不是写出每个div id并将其设置为隐藏我想做一个循环所以我把我的div放在UL列表中.但我似乎无法弄清楚如何隐藏UL列表中的div.

$("#panels li").each(function (i) {
        $('div').toggle();
    });

<ul id="panels">
        <li><div id="dvError" class="hiddencol">this is div 1</div></li>
        <li><div id="dvconfirm" class="hiddencol">this is div 2</div></li>
</ul>
Run Code Online (Sandbox Code Playgroud)

由于某种原因,当我这样做它隐藏它们但它隐藏在我的页面上的每个div :(

html jquery html-lists

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

在webform中使用带有母版页的dropzone.js

我正在尝试让dropzonejs脚本在包含母版页和子网页的asp.net站点中工作.我有一个好主意如何从这个问题,但这适用于一个简单的webform ..如何让它在具有母版页的aspx页面上工作?

所以我的主页现在有这个:

<body class="fixed-top">
     <form id="form1" runat="server" autocomplete="off" class="dropzone">
       <div id="container">
            <div id="body">
                <div class="container-fluid">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
                </div>
             </div>
        </div>
     </form>
</body>
Run Code Online (Sandbox Code Playgroud)

在我的aspx页面中我有这个:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <h3 class="page-title">Filemanager</h3>
     <div class="box"> <!--INSIDE THIS IS WHERE I WOULD WANT DROPZONE TO LOAD-->
        <div>
            <div class="fallback">
                <input name="file" type="file" multiple />
            </div>
        </div>
    </div>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)

问题是它加载但是在容器之外..任何想法?

asp.net webforms master-pages dropzone.js

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

php将秒转换为时间戳

我在我的表中有一个总秒值,但我想得到一个时间格式,例如hh:mm:ss,目前我有:seconds - 226我知道应该按时间格式4分26秒,但我已经尝试过这段代码:

$seconds = 226;
$hours = floor($seconds / 3600);
$mins = floor(($seconds - ($hours*3600)) / 60); 
$secs = floor(($seconds - ($hours*3600)) - ($mins*60));
Run Code Online (Sandbox Code Playgroud)

这个输出 3:46

也许公式有问题?

编辑:我从一个返回视频持续时间的youtube脚本获得此值:

    $ytvidid = $url;
$ytdataurl = "http://gdata.youtube.com/feeds/api/videos/". $ytvidid;
$feedURL = $ytdataurl;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $feedURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// get the result of http query
$output = curl_exec($ch);
curl_close($ch);
// feed the curl output to simplexml_load_string
$sxml = simplexml_load_string($output) or die("XML string not loading");

//$sxml = …
Run Code Online (Sandbox Code Playgroud)

php time

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

使用内联Request.QueryString来构建url

我不确定我是否正确,但我有这个:

<a href="mypage.aspx?id=<% Request.QueryString["id"].ToString(); %>&sec=map">
    Map
</a>
Run Code Online (Sandbox Code Playgroud)

但它不会将ID添加到url查询字符串.不知道该怎么做因为我真的不想在代码端构建一堆文字.

我得到的网址是:

mypage.aspx?id=&sec=map
Run Code Online (Sandbox Code Playgroud)

c# asp.net query-string

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