小编met*_*lah的帖子

警告:mail()[function.mail]:无法连接到"localhost"端口25的邮件服务器

我一直在尝试在我正在建立的网站上设置忘记密码设施,但每次我尝试加载页面时都会遇到错误:

警告:mail()[function.mail]:无法连接到"localhost"端口25的邮件服务器,验证php.ini中的"SMTP"和"smtp_port"设置或使用ini_set()

我该如何解决这个问题?

这是我到目前为止的代码:

<?php

            if (array_key_exists('forgot',$_POST)) {

      $email = $_POST['email']; 

      mysql_select_db($database_speedycms, $speedycms);
      $query_email = "SELECT * FROM tbl_users WHERE email='$email'";
      $email = mysql_query($query_email, $speedycms) or die(mysql_error());
      $row_email = mysql_fetch_assoc($email);
      $totalRows_user = mysql_num_rows($email);

      mysql_query("SELECT * FROM users WHERE email='$email'");

      if($totalRows_user == 0)

      {
      echo "<span class='form2'>We're sorry, but we could not find a user with that email address.<p>Please try again.<p>
      <a href='forgotpassword.php' class='form'>Return</a></span>";
      }

      else

      {


        // create a random password 
      function createRandomPassword() { 
      $chars = "abcdefghijkmnopqrstuvwxyz023456789"; 
         srand((double)microtime()*1000000); 
         $i = …
Run Code Online (Sandbox Code Playgroud)

php mysql

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

Javascript数学结果不正确,删除NaN消息

我试图在JavaScript中运行以下总和

(a + b) - c

但不幸的是我一直得到以下结果(例如太阳):

(25 + 25) - 1

= 2524

这是我目前正在使用的代码

     <script>
    $(document).ready(function(){
      $('#previousRent').change(function(){
        calcResult();
      });
      $('#rentPaid').change(function(){
        calcResult();
      });
      $('#wRun').change(function(){
        calcResult();
      });
    });
    function calcResult() {
      $('#result').val( parseFloat($('#previousRent').val() + parseFloat($('#wRun').val()) - $('#rentPaid').val()) );
    }
  </script>   
Run Code Online (Sandbox Code Playgroud)

有没有人知道如何摆脱所有字段未填充时出现的NaN?

javascript

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

更改mPDF上的页面大小并使浏览器自动打印显示的PDF文件

我正在使用mPDF(http://mpdf.bpm1.com)创建pdf收据,但此刻它们只显示在一个完整的A4页面上.

我想将它们调整到合理的大小,因为我们使用的是epson tm-t88iv.这是我的第一个困境.

我遇到的第二个问题涉及在连接的打印机上调用自动打印.

我希望在处理表单时(在同一页面上)执行此操作.

但我不知道如何将其实现到我现在的代码中:

  <?php 

// post

$id = $_GET['id'];
$user = $_GET['user'];
$week = $_GET['week'];
$pRent = $_GET['pRent'];
$rentPaid = $_GET['rentPaid'];
$result = $_GET['result'];
$pDate = date("d/m/Y");

$html = '

<style>
@page {
 margin-top: 20px;
 margin-left: 20px;
}
</style>

<div style="text-align:center; font-family: Arial, Helvetica, sans-serif;">
        <div style="border: 0px; padding: 0px; width: 175px; text-align:center;">
        <img src="resources/speedline.png" width="161" height="58" />
        <p style="font-weight: bold;" align="center">
        DRIVER '.$id.' RECEIPT</p>    
  <p style="font-size: 12px; font-family: Arial, Helvetica, sans-serif;">'.$week.'</p>
    <span style="font-size: 10px;">PROCESSED …
Run Code Online (Sandbox Code Playgroud)

javascript php

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

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

在 AHK 脚本中处理循环

我一直在想 - 在 ahk 脚本中处理循环的最佳方法是什么?

例如,而不是:

; Collect results 1
Sleep 1000
Addr1 := IE.document.getElementsByClassName("name")[0].innertext
String_Object := StrSplit(addr1, "`,")
If (Substr(Addr1, 1, 2) = "MK")
{
Addr1 := String_Object[2] . "," . Trim(String_Object[3]) . "," . PostCode
MsgBox, %Addr1%
}
Else
{
Addr1 := String_Object[1] . "," . Trim(String_Object[2]) . "," . PostCode
MsgBox, %Addr1%
}


; Collect results 2
Sleep 1000
Addr2 := IE.document.getElementsByClassName("name")[1].innertext
String_Object := StrSplit(addr2, "`,")
If (Substr(Addr2, 1, 2) = "MK")
{
Addr2 := String_Object[2] . …
Run Code Online (Sandbox Code Playgroud)

autohotkey

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

Excel公式使用纬度/经度坐标计算多个点之间的距离

我目前正在制定一个带有两个表的模拟数据库架构:BookingWaypoint

  • Booking 存储出租车预订信息。

在此输入图像描述

  • Waypoint 存储旅途中的接送点以及经纬度位置。每个序列都是旅程中的一站。

在此输入图像描述

如何在 Excel 中计算每次旅程中不同站点之间的距离(使用纬度/经度数据)?

有没有一种方法可以在Excel中以编程方式定义它,即可以将公式放入列mileage(表)中,在表中查找该旅程的Booking匹配序列(通过)并返回结果?bookingIdWaypoint

示例1:

行程有 2 站:

1   1   1   MK4 4FL, 2, Levens Hall Drive, Westcroft, Milton Keynes 52.002529   -0.797623
2   1   2   MK2 2RD, 55, Westfield Road, Bletchley, Milton Keynes   51.992571   -0.72753
Run Code Online (Sandbox Code Playgroud)

根据 Google 的数据,4.1 英里,在表mileage中的列中输入Booking,其中id = 1

示例2:

行程共 3 站:

6   3   1   MK7 7DT, 2, Spearmint Close, Walnut Tree, Milton Keynes 52.017486   -0.690113
7 …
Run Code Online (Sandbox Code Playgroud)

excel formula

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

重构其他if语句从周三返回当前周

我很担心CurrentRentWeek.cs中的代码是否具有面向未来的能力,是否有这么多其他if语句的好习惯?如果没有,重构它的最佳方法是什么?

MainWindow.Xaml.cs

    public MainWindow()
    {
        InitializeComponent();

        // Set current rent week
        var datecheckObject = new CurrentRentWeek();
        CurrentRentWeekTextBlock.Text = datecheckObject.DateCheck(CurrentRentWeekTextBlock.Text);
    }
Run Code Online (Sandbox Code Playgroud)

CurrentRentWeek.cs

    public string DateCheck(string rentWeek)
    {
        if (_today.DayOfWeek == DayOfWeek.Monday)
        {
            _cRentWeekStart = _today.AddDays(-5);
            _cRentWeekEnd = _today.AddDays(2);
            rentWeek = "Current Rent Week: " + _cRentWeekStart.ToString("dd/MM/yyyy") + " - " +
                       _cRentWeekEnd.ToString("dd/MM/yyyy");
        }
        else if (_today.DayOfWeek == DayOfWeek.Tuesday)
        {
            _cRentWeekStart = _today.AddDays(-6);
            _cRentWeekEnd = _today.AddDays(1);
            rentWeek = "Current Rent Week: " + _cRentWeekStart.ToString("dd/MM/yyyy") + " - " +
                       _cRentWeekEnd.ToString("dd/MM/yyyy");
        }
        else …
Run Code Online (Sandbox Code Playgroud)

c# if-statement

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

以编程方式在ng-repeat元素上切换类

我想以编程方式在单个ng-repeat元素上切换类,但我的代码似乎将其设置为所有元素,并且无法重置它.我怎样才能解决这个问题?

instant.html

<div class="item item-button-right" ng-repeat="service in businessServiceList | filter:services">
  {{service.title}}
  <div class="buttons" style="padding: 0px">
    <button class="button {{buttonStyle}}" ng-click="changeButtonStyle()">
      <i class="ion-android-done"></i>
    </button>
    <button class="button button-stable">
      <i class="ion-android-more-horizontal"></i>
    </button>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

controller.js

.controller('BookCtrl', function($scope, ServicesData, $stateParams) {
  $scope.businessServiceList = ServicesData.getBusinessServiceList ($stateParams.business);
  $scope.buttonStyle="button-stable";
  $scope.changeButtonStyle = function(){
    $scope.buttonStyle="button-positive";
  }
})
Run Code Online (Sandbox Code Playgroud)

javascript angularjs ionic-framework

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

jQuery($(this).parent()发现不起作用

我似乎无法让jquery找到我所拥有的产品网格.知道如何设置它吗?

<div id="sold-out" style="margin-top: 10px">
  <a class="grid-view-item__link grid-view-item__image-container" href=
  "/products/moringa-and-coconut-soap"></a>
  <form accept-charset="UTF-8" action="/contact#contact_form" class=
  "contact-form" id="contact_form" method="post" name="contact_form">
    <a class="grid-view-item__link grid-view-item__image-container" href=
    "/products/moringa-and-coconut-soap"><input name="form_type" type="hidden"
    value="contact"><input name="utf8" type="hidden" value="?"></a>
    <p><a class="grid-view-item__link grid-view-item__image-container" href=
    "/products/moringa-and-coconut-soap"></a><a class=
    "product-page-notify-me notify-me" href="#" style="color: #788188;">Email
    me when available</a></p>
    <div class="clearfix notify-me-wrapper" style="display:none">
      <input class="styled-input" name="contact[email]" placeholder=
      "your@email.com" required="required" style="float:left; width:100%;"
      type="email" value=""> <input name="contact[body]" type="hidden" value=
      "Please notify me when Moringa and Coconut Soap becomes available.">
      <input class="btn styled-submit" style="float:left;" type="submit" value=
      "Send">
    </div>
  </form> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

对象数组在过滤器上运行后返回 undefined

我有一个具有以下结构的数组

let pageComponents = { pages: [ { "components": [ ... ] }, { "components": [ ... ] } ] };
Run Code Online (Sandbox Code Playgroud)

有关的内容,请参阅从对象数组中删除空条目components

我尝试在其上运行以下过滤器方法,但之后对象数组返回 null。关于如何修复它的任何想法?

  static deleteEmptyComponentsOnMultiplePages(components) {
    return components['pages'].forEach(obj => {
        obj['components'].filter(item => item !== null);
      }
    );
  }
Run Code Online (Sandbox Code Playgroud)

javascript typescript

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