小编Ika*_*ari的帖子

[PHP警告:mail():"sendmail_from"未在php.ini中设置或自定义"From:"标头丢失

我正在尝试使用PHP的mail()函数发送测试邮件.

$to = "****@gourab.me";
$sub = "Php Mail";
$msg = "Test Message From PHP";

mail($to, $sub, $msg, "From: **********@gmail.com");
Run Code Online (Sandbox Code Playgroud)

当我尝试通过stepin 调试它时phpdbg,它显示消息:

[PHP Warning: mail(): " sendmail_from" not set in php.ini or custom "From:" header 
missing in C:/xampp/htdocs/tinyProj/mail.php on line 4]
Run Code Online (Sandbox Code Playgroud)

我不明白为什么?

php email

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

如何解析PHP错误日志?

好吧,我试图解析 PHP 错误日志。因此我构建了以下类:

<?php
/**
 * Created by PhpStorm.
 * User: toton
 * Date: 2/29/2016
 * Time: 8:16 AM
 */
final class error_parser
{
    private $log_file_path;
    private $current_line;
    private $recent;

    /**
     * error_parser constructor.
     * Takes in the path of the error log file of PHP ERROR LOG FILE.
     * And another param for checking to get the direction to traverse the file.
     * @param string $log_file_path
     * @param bool $recent
     */
    public function __construct($log_file_path, $recent = true)
    {
        $this->log_file_path …
Run Code Online (Sandbox Code Playgroud)

php error-handling parsing

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

当我从空闲导入`http.server`时它工作,但当我运行一个有'import http.server`的python文件时出现错误

当我使用时:

>>> import http.server
Run Code Online (Sandbox Code Playgroud)

IDLE没有任何错误.
但是当我使用这段代码时:

import http.server
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer

def run(server_class = HTTPServer, handler_class = BaseHTTPRequestHandler):
    server_address = ('', 8000)
    httpd=server_class(server_address, handler_class)
    httpd.serve_forever()


run()
Run Code Online (Sandbox Code Playgroud)

有一个错误如下:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 2195, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/toton/Projects/http.py", line 1, in <module>
    import http.server
  File "/home/toton/Projects/http.py", line 1, in …
Run Code Online (Sandbox Code Playgroud)

python module http python-3.x

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

无法获取网址的最后一部分

我正在尝试获取此url字符串的最后一部分: national/italy/serie-a/20152016/s11663/

我的目标是:s11663这是我的代码:

$path = parse_url("national/italy/serie-a/20152016/s11663/", PHP_URL_PATH);
$pathFragments = explode('/', $path);
$end = end($pathFragments);
var_dump($end);
Run Code Online (Sandbox Code Playgroud)

但我得到:

string(0)""

我做错了什么?

html php

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

如何在php中访问受保护的json数组

我正在使用facebook sdk for php.它返回一个我无法使用的受保护的json数组.可以有另一种使用受保护阵列的方法.
这是我的代码:

<?php
  require 'phpInsight-master/autoload.php';
  require_once 'autoload.php';

  use Facebook\FacebookSession;
  use Facebook\FacebookRedirectLoginHelper;
  use Facebook\FacebookRequest;
  use Facebook\FacebookResponse;
  use Facebook\FacebookSDKException;
  use Facebook\FacebookRequestException;
  use Facebook\FacebookAuthorizationException;
  use Facebook\GraphObject;
  use Facebook\Entities\AccessToken;
  use Facebook\HttpClients\FacebookCurlHttpClient;
  use Facebook\HttpClients\FacebookHttpable;

  $sentiment = new PHPInsight\Sentiment();

  FacebookSession::setDefaultApplication('APP ID', 'APP SECRET');

  /*$helper = new FacebookRedirectLoginHelper('http://123.63.13.117/');
  try
  {
    $session = $helper->getSessionFromRedirect();
  }
  catch(FacebookRequestException $e)
  {
    echo 'Failure: ' . $e->getMessage();
  }
  catch(Exception $e)
  {
    echo 'Failure: ' . $e->getMessage();
  }
  */
  $raw_id = $_GET['id'];
  $id = '/' . $raw_id;
  echo $id;
  $session …
Run Code Online (Sandbox Code Playgroud)

php arrays json facebook

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

标签 统计

php ×4

arrays ×1

email ×1

error-handling ×1

facebook ×1

html ×1

http ×1

json ×1

module ×1

parsing ×1

python ×1

python-3.x ×1