小编Mag*_*Man的帖子

无法使MailChimp API Curl工作

我尝试过尝试使用curl将数据发送到MailChimp,但无法将数据保存在MailChimp中.任何有关这方面的帮助将不胜感激!

这是我的代码:

$mailChimpUrl = "http://us2.api.mailchimp.com/1.3/?method=listSubscribe";
$merges = array(
    'FNAME'=>'Dave', 
    'LNAME'=>'Gilmour',
    'BUILDING'=>'Central High School',
    'MMERGE17' => '35904',
    'MMERGE12'=>'Yes'
);

$apikey="myrealapiishere-us2";
$listId="myrealformidishere";
$email="zz22@aol.com";
$double_optin=true;
$update_existing=false;
$replace_interests=true;
$send_welcome=false;
$email_type = 'html';            
$data = array(
    'email_address'=>$email,
    'apikey'=>$apikey,
    'merge_vars' => $merges,
    'id' => $listId,
    'double_optin' => $double_optin,
    'update_existing' => $update_existing,
    'replace_interests' => $replace_interests,
    'send_welcome' => $send_welcome,
    'email_type' => $email_type
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $mailChimpUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));      
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$result = curl_exec($ch);
curl_close($ch);
Run Code Online (Sandbox Code Playgroud)

php curl mailchimp

5
推荐指数
2
解决办法
8422
查看次数

悬停动画上的jQuery多次触发

我想弄清楚为什么我的悬停功能表现得很奇怪.当您将鼠标悬停在div上时,另一个div变为可见.但是,当我将光标向下移动到可见的div时,它会淡出并再次淡入.这不应该发生,应该保持可见,直到我的光标离开主容器.

这是我的代码.

HTML

<div id="searchWrapper" class="fleft">
    <div class="box">Hover here!</div>
    <div class="searchLinks" style="display: none;">
        <form id="search_mini_form" action="" method="get">
            <div class="form-search">
                <label for="search">Search:</label>
                <input id="search" type="text" name="q" value="" class="input-text" maxlength="128" autocomplete="off">
                <button type="submit" title="Search" class="button"><span><span>Search</span></span></button>
                <div id="search_autocomplete" class="search-autocomplete" style="display: none;"></div>
                <script type="text/javascript">
                    //<![CDATA[
                    var searchForm = new Varien.searchForm('search_mini_form', 'search', '');
                    searchForm.initAutocomplete('http://removed.com/index.php/catalogsearch/ajax/suggest/', 'search_autocomplete');
                    //]]>
                </script>
            </div>
        </form>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

jQuery的

<script type="text/javascript">
    jQuery(function($) {

        $("#searchWrapper").hover(
            function () {
                $(".searchLinks").fadeIn( 500 );
            },
            function () {
                $(".searchLinks").fadeOut( 500 );
            }
        );

    });
</script>
Run Code Online (Sandbox Code Playgroud)

CSS …

jquery fadeout fadein jquery-hover

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

SSH2无法在新服务器上运行

我们已经更改了托管公司,ssh2工作的地方已经不再适用了.我们已ssh2启用新服务器并已allow_url_fopen启用.

我能看到的唯一区别是使用的旧服务器PHP 5.4.45和新服务器正在使用PHP 5.6.28.

但是,我现在得到以下错误. Could not open remote file: ssh2.sftp://Resource id #337/my/directory/file.txt

这是我的代码示例:

$remote_host = "myhostinfohere";
$remote_port = 22;
$remote_user = "myuser";
$remote_pass = "mypassword";
$remote_dir = "/my/directory/";
$remote_file = 'file.txt';

try {
    $remote_conn = ssh2_connect($remote_host, $remote_port);    
} catch (Exception $e) {
    die("could not connect to ".$remote_host);
}

try {
    ssh2_auth_password($remote_conn, $remote_user, $remote_pass);
} catch (Exception $e) {
    die("Password failed on ".$remote_host);
}

$sftp = ssh2_sftp($remote_conn);

$fetch_string = "ssh2.sftp://$sftp" . $remote_dir …
Run Code Online (Sandbox Code Playgroud)

php libssh2 ssh2-sftp

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

Solidity - 标识符未找到或不唯一 onlyOwner()

运行时出现以下 truffle 编译错误truffle compile

DeclarationError : Identifier not found or not unique.
   --> project:/contracts/TestCoin.sol:183:56:
    |
183 |     function excludeFromRewards(address account) public onlyOwner() {
    |   

                                                 
Run Code Online (Sandbox Code Playgroud)

我的代币合约中有以下代码。

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";

contract TestCoin is ERC20 {

    constructor(_name, _symbol) {
        _name = name();
        _symbol = symbol();
    }

    .......

    function excludeFromRewards(address account) public onlyOwner() {
        .......
    }

    .......
}
Run Code Online (Sandbox Code Playgroud)

有谁知道我在这里缺少什么?我似乎无法克服这一点,并且正在导入文件Ownable.sol,所以我很困惑为什么会发生这种情况。我是否需要说使用 Ownable 作为导入的任何内容?我认为它只会继承这些导入。

更新

如果我调用位于 ownable.sol 中的所有者函数,我会得到相同的错误。

if(owner() == msg.sender)

Undeclared …
Run Code Online (Sandbox Code Playgroud)

compiler-errors compilation solidity

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