我正在尝试使用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 错误日志。因此我构建了以下类:
<?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) 当我使用时:
>>> 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) 我正在尝试获取此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)""
我做错了什么?
我正在使用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)