Jump to content

an extra "1" is appearing??


RON_ron

Recommended Posts

A

<?php
echo "names/new_batch/DataSheet.pdf";
?>

 

B

<?php
$link = require( dirname( __FILE__ ) . '/../../../../essentials/myData.php' );
echo ($link);
?>

 

when i call B the result is is shown with an extra "1" at the end

 

names/new_batch/DataSheet.pdf1

 

What am I doing wrong? How can I get the output as "names/new_batch/DataSheet.pdf"

Link to comment
Share on other sites

require statements insert the content of the required file in place of the require statement. They don't return the content of the file (edit: unless you are using a URL.) The only time (edit: when you are using a file system path) a value other than a true/1 (success) or false (failure) is returned by a require statement is if you use a return statement in the required file.

 

 

Link to comment
Share on other sites

How do I put this in my email code? When i use the code below, it shows the URL as "1"?

<?php
$link = require( dirname( __FILE__ ) . '/../../../../essentials/myData.php' );
return ($link);

//rest of the code

<a href='http://www.web.com.au/'".$link."' target='_blank'> <img src='http://www.web.com.au/dir/image_mail.gif' style='max-width:110px;' mc:label='image' mc:edit='tiwc200_image00' /></a>

//rest of the code
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.